Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!lavaca.uh.edu!uhnix1!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.unix.questions Subject: Re: Piping into Shell scripts Message-ID: Date: 8 Mar 90 15:30:45 GMT References: <1990Feb28.142050.11607@virtech.uucp> <10650083@hpisod2.HP.COM> <12311@smoke.BRL.MIL> Reply-To: peter@ficc.uu.net (Peter da Silva) Organization: Xenix Support, FICC Lines: 11 > >> > >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. . / \ 'U` \_.--._/ v