zjunior has a pretty good idea about doing it (GATEWAY_INTERFACE will be defined if the script is run through a web-server), but what if some joker sets GATEWAY_INTERFACE to bash in his .bashrc? (stupid I know, but it's been known to happen ;), well from
perlfaq8
How do I find out if I'm running interactively or not?
Good question. Sometimes -t STDIN and -t STDOUT can give clues, someti
+mes not.
if (-t STDIN && -t STDOUT) {
print "Now what? ";
}
-t tells you if a filehandle is tied to a tty.
Now I don't know what happens during forking and the like, but the above usually works ;)