On 01 August 2006 20:20, John J. Foster wrote:
> Good afternoon,
>
> In a bash script, how can I test whether the script itself is being
> run from a virtual terminal, or from an emulator like konsole within X?

See this script by the name "strangename":

#! /bin/sh

ps ax | grep strangename


If run in a terminal under X it will output something like:#
20516 pts/3    R+     0:00 grep strangename

Please note the "pts".

Run from a virtual text terminal, that will be something like "tty4". 

Instead of actually displaying the output, you can analyse it within your 
script.

Uwe

-- 
Mark Twain: I rather decline two drinks than a German adjective.
http://www.SysEx.com.na
-- 
[email protected] mailing list

Reply via email to