[OT] how can a bash script determine if it's running in an xterm???

Joe(theWordy)Philbrook jtwdyp at ttlc.net
Sat Jul 10 01:46:17 UTC 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


>  Jul  7 Steven W. Orr        (3098) Re: [OT] how can a bash script determin
>  Jul  7 Jeff Vian            (3145) Re: [OT] how can a bash script determin
>  Jul  7 Robert P. J. Day     (2103) Re: [OT] how can a bash script determin
>  Jul  8 Nifty Hat Mitch      (3759) Re: [OT] how can a bash script determin



Thanks guys, I appreciate the help. Actually though Somebody sent me an
test script off list that does a good job of demonstrating how a bash script
can check for all three conditions, AND points at the wealth of info
that can be extracted with env. I wanted to offer a big Thank you but I
seam to have lost the e-mail... Sigh!

I know I had it, as I copied the script from it. And I don't remember
deleting that E-mail message but I can't find it.

So to you who sent me a script something like this. (you know who you
are...) THANKS!


>> #!/bin/bash
>> 
>> if ! tty -s
>> then
>>         echo "Running non-interactive.." > ~/wai
>> elif test ! -z $DISPLAY
>> then
>>         echo "Running in GUI" > ~/wai
>> else
>>         echo "Running on console" > ~/wai
>> fi
>> echo '___________' >> ~/wai
>> env >> ~/wai


- -- 
|   ---   ___
|   <0>   <->	   Joe (theWordy) Philbrook
|	^		J(tWdy)P
|    ~\___/~	     <<jtwdyp at ttlc.net>>

   ##############################################################
   # You can find my public gpg key at http://pgpkeys.mit.edu/  #
   ##############################################################

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA70orRZ/61mwhY94RAk4AAJ9poRtrONnRWSifRWoHFZjfxCPJ6QCgkAPp
OGHCmUqIe156NG4Qb/MonyQ=
=hA5q
-----END PGP SIGNATURE-----





More information about the users mailing list