Piping into Shell scripts

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Mar 8 10:06:47 AEST 1990


In article <IL22A+1xds13 at ficc.uu.net> peter at ficc.uu.net (Peter da Silva) writes:
>> > >Is there any way of getting a Shell script (C or Bourne) to recognise
>> > >whether it is receiving input from a pipe?
>... bunch of non-optimal answers deleted ...
>if [ -t 0 ]

Why, so you prefer YOUR non-optimal answer?
The fellow said "pipe" not terminal.
{class of pipes} + {class of terminals} != {class of files}
Maybe he SHOULD have asked about terminals instead?
If so, he may be in trouble, because it's not at all clear that
"terminal" is a well-defined notion in our modern environments,
or if you do figure out a definition that it would fit his needs.
(Suppose, e.g., you are piping through a pair of terminals that
have been put into a transparent transmission mode.)



More information about the Comp.unix.questions mailing list