Reading input piped to a bash script
From: Olle Eriksson (pt00oer_at_student.bth.se)
Date: 10/18/04
- Previous message: Justin Guerin: "Re: can only ping after kernel upgrade"
- Next in thread: Mason Loring Bliss: "Re: Reading input piped to a bash script"
- Reply: Mason Loring Bliss: "Re: Reading input piped to a bash script"
- Maybe reply: Sergio Basurto: "Re: Reading input piped to a bash script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: debian-user@lists.debian.org Date: Mon, 18 Oct 2004 19:51:49 +0200
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 debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
- Previous message: Justin Guerin: "Re: can only ping after kernel upgrade"
- Next in thread: Mason Loring Bliss: "Re: Reading input piped to a bash script"
- Reply: Mason Loring Bliss: "Re: Reading input piped to a bash script"
- Maybe reply: Sergio Basurto: "Re: Reading input piped to a bash script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|