Detecting Pipe Using Bourne Shell

Leo de Wit leo at philmds.UUCP
Sat Apr 8 20:01:28 AEST 1989


In article <18992 at adm.BRL.MIL> ifenn%ee.surrey.ac.uk at nss.cs.ucl.ac.uk (Ian Fenn) writes:
    []
|The only problem with this is that I cannot pipe the output from another 
|program into it because it drops into the main menu and out again! Probably 
|due to the test for arguments. Can anyone therefore tell me how to detect a 
|pipe using Sh, so that the following will work? Or suggest another way 
|round the problem?

if test -t 0
then
    # stdin from terminal
else
    # stdin not from terminal
fi

    Leo.



More information about the Comp.unix.wizards mailing list