Hi

Can anyone explain how I can read input to a bash script through a pipe?

I want to be able to receive input both through a pipe, and through 
parameters to the script. For example:

  echo "blabla" | myscript.sh
and
  myscript.sh "blabla"

The script should be able to check whether or not any input is coming 
through the pipe, and if not use $1. I have tried with cat and read but 
they always asks the user interactively if nothing is piped to the 
script.

Thanks
Olle


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to