Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.questions Subject: Re: Piping into Shell scripts Message-ID: <12311@smoke.BRL.MIL> Date: 8 Mar 90 00:06:47 GMT References: <1990Feb28.142050.11607@virtech.uucp> <10650083@hpisod2.HP.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 In article peter@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.)