Shell, pipe, input, etc… 

Newsgroups: comp.unix.shell
> How can I detect the execution mode of my shell script (whether being
> piped or not)...

Use tty(1):

$ sh foo.sh
0
$ echo foo | sh foo.sh
1
$ cat foo.sh
tty -s
echo $?

Derek

documented on: 2000.08.15 Tue 12:10:03