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?
>
> Thanks,
> festus
Hello,
Here is yet another approach.
So I would use the command "tty".
========
[EMAIL PROTECTED] ~ $ whatis tty
tty (1) - print the file name of the terminal connected to standard input
========
So the check could look something like this:
#!/bin/sh
for ttyX in /dev/tty*;
do
[ "`tty`" == "$ttyX" ] && { echo "no X" ; break ; }
echo "X section"
done
--
Best regards,
Daniel
--
[email protected] mailing list