Piping into Shell scripts

Peter da Silva peter at ficc.uu.net
Fri Mar 9 01:30:45 AEST 1990


> >> > >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?

Because it produces the same result with less overhead. I can't think of
a way to tell if input is from a pipe *from the shell using standard
programs*. In practice, though, this question usually means "How do I tell
if input is interactive or not".
-- 
 _--_|\  `-_-' Peter da Silva. +1 713 274 5180. <peter at ficc.uu.net>.
/      \  'U`
\_.--._/
      v



More information about the Comp.unix.questions mailing list