D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] shell script



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

On Monday 17 June 2002 11:10 pm, paul sutton wrote:
#/bin/bash
pwd > pwd1
cd /opt/legacy-1.32beta4
./llxdoom

echo exiting game
cd < pwd1

If I run in a console I get the message error (DISPLAY=[(NULL)])
If I run in xterm it works,(as it uses the xdisplay)  how do I test if the
user is running a console or xterm, and print say "please run in xterm" or
something.  I have attempted this with the if to fi statements  see below
.however I think my pwd > pwd1 is getting in the way (the idea is to save
the current path to a file then when the game exits go back to the user
home directory

you can test to see if the user is in an xterm easily enough like this:


#/bin/bash

if [ "$DISPLAY" ]; then
pwd > pwd1
cd /opt/legacy-1.32beta4
./llxdoom
echo exiting game
cd < pwd1
else
echo "Not in an xterm"
fi

~ Theo ?

- -- 

Theo Zourzouvillys
http://zozo.org.uk/

Your love life will be happy and harmonious.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9D218448CrwpTn6YRAh0uAJwLLn9nHKIixmz3JwmCyFfg1M+aQACeLt1Y
hNa7Ryf4F8qXlNHrQc6Lw0g=
=f7U3
-----END PGP SIGNATURE-----


--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly