You are not logged in.
Pages: 1
How can I detect if a script is executed in a X environment or outside?
Thanks
Offline
As in you want the script to know whether it is in X or not? Or you want a separate program to check if a script was started in X?
For the first, I reckon just checking to see if DISPLAY is set is enough.
For the second, I have no idea.
Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB
Offline
2nd: if $DISPLAY is NOT set.
Offline
Thanks everyone, here the solution... easy and working:
if [ ${DISPLAY} == "" ]
then
elinks
else
firefox
fi
Offline
Pages: 1