Piping into Shell scripts

Andy Clews andy at syma.sussex.ac.uk
Wed Feb 28 03:58:55 AEST 1990


Is there any way of getting a Shell script (C or Bourne) to recognise
whether it is receiving input from a pipe?

My script includes something like this:

	echo "Please enter message text and then enter a CTRL D"
	cat > foo
	etc.etc.

In some circumstances I might want to pipe text into the script, so I
don't want it to echo the prompt message.  I have RTFM (hope I haven't
missed something).  Can anyone help?

-- 
Andy Clews, Computing Service, Univ. of Sussex, Brighton BN1 9QN, England
JANET: andy at syma.sussex.ac.uk   BITNET: andy%syma.sussex.ac.uk at uk.ac



More information about the Comp.unix.questions mailing list