On Wed, 2004-07-07 at 11:51, Joe(theWordy)Philbrook wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > Actually there are three states I want to base some conditional execution > on. > > I can do this now based on feeding the script a command-line argument. > But I'm wanting to have the script itself determine if: > > 1) It's running in a VT such as found in runlevel 3 or via ctrl+alt+F1 > in runlevel 5. > > 2) It's running in an "xterm", "konsole", "aterm", or (ANY other x based > terminal window). > > 3) It's not attached to a terminal or VT (such as might happen if the > script was called from alt+F2 run prompt). > > How can a bash script test it's environment for these three different > conditions??? > > Please! and Thank you! > I have not tried what you want, Someone else may be able to give a complete answer. However, when I have a similar question, a very good and handy reference to locate the answers for most and to lead me in the right direction in shell scripting is the book /UNIX shell programming/ by Lowell Jar Arthur and Ted Burns. If I am considering Perl instead of the shell I use the /Perl Cookbook/ and /Programming Perl/ among others to get the details as to how/why it works that way. With these and a little research I find most things I need for anything I want to do. Over time even the difficult task becomes easier as the techniques are learned. YMMV Jeff