From: | Wonko@wonkology.org (Alex Schuster) | ||
---|---|---|---|
To: | gentoo-user@l.g.o | ||
Subject: | Re: [gentoo-user] Test for X from cli | ||
Date: | Tue, 01 Aug 2006 20:13:58 | ||
Message-Id: | 9z2ElB3ed8B@wonkology.org | ||
In Reply to: | [gentoo-user] Test for X from cli by "John J. Foster" |
1 | John writes: |
2 | |
3 | > In a bash script, how can I test whether the script itself is being |
4 | > run from a virtual terminal, or from an emulator like konsole within X? |
5 | |
6 | You can check the existance of the DISPLAY environment variable: |
7 | |
8 | if [[ $DISPLAY ]] |
9 | then |
10 | echo "We're running under X" |
11 | else |
12 | echo "No X running." |
13 | fi |
14 | |
15 | |
16 | Alex |
17 | -- |
18 | gentoo-user@g.o mailing list |