Try this:
if ("`tty`" == "/dev/console") then
# console dependent instructions
endif
(The coding of the 'if' instruction based upon assumption you are using
[t]csh)
* - * - *
Paul-Joseph "Dragon" de Werk | Carpe diem.
Department of Computer Science | "First things first, but not
California State University, Fresno | necessarily in that order."
HELLO! I'm a .signature virus! Join in and copy me into yours!
1. How can my script tell if I am in the console?
I use zgv to display images when I am in the console (ttyv0).
This won't work if I am in another ttyv.
I want to write a script to use zgv to display a picture if I
am in the console and xzgv if I am in X. I want it to bail
otherwise (i.e. if I am in another ttyv).
I want this script (showpics) to be mapped to image/* in
.mailcap and in lynx.
I know I can test $DISPLAY to see if I am in X (it isn't set
if I am in a ttyv.
However, tty doesn't tell me if lynx or the mail program I am
using is running in ttyv0.
Here is my attempt at the script:
#!/bin/sh
#show-pics
ISCONSOLE=`tty`
if [ "$DISPLAY" = "" ];
then
#if [ "$ISCONSOLE" = "/dev/ttyv0" ];
#then
zgv $1
else
echo not in console
fi
else
xzvg $1
fi
#end
This works fine from the command line. But 'tty' returns
"not a tty" when this script is invoked by lynx, etc. I
gather this doesn't work because STANDARD INPUT is then
something else. What I need to know is whether lynx or
whatever is running in the console so that zgv will
succeed. How can my script tell?
--
It's important for us to explain to our nation that life is important. It's
not only life of babies, but it's life of children living in, you know, the
dark dungeons of the Internet.--G.W. Bush, Arlington Heights, Ill.,10/24/00
3. Need HELP to Log User Log-ins form the internet
4. AIM File Transfers and iptables
5. logging - "secure" logs don't tell me who is logging in?
7. Solaris 2.4 Can't tell when logins are not on the console
9. How to tell whether a hardware RAID controller is installed?
10. In solaris 8 how to tell whether the network interface is in promiscuous mode
11. Gadget to tell me whether PPP is up
12. How to tell whether there is a server monitoring an AF_UNIX socket ?
13. how to tell whether running 32-bit or 64-bit