Reading input piped to a bash script
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
Reply to: