A few of my scripts (keymap changing, public key adding) need to act differently when in a virtual console vs. in an xterm. What's the real code for
#!/bin/ksh
if [[ in_a_virtual_console ]]; then
...
else
...
fi
|
A few of my scripts (keymap changing, public key adding) need to act differently when in a virtual console vs. in an xterm. What's the real code for
|
|||
|
|
|
It sounds to me like you want to check whether or not there is a X server to connect to. Something like:
|
|||||
|
|
If you meant to distinguish interactive from noninteractive shells, use
If you really meant whether you're on a tty/pty/pts or something else, parse the output from
|
|||
|
|
This will depend on the operating system. For Linux, you could do this:
This, of course, assumes that you have not changed the |
|||
|