Re: Reading input piped to a bash script

2004-10-18 Thread Olle Eriksson
On Monday 18 October 2004 22.07, Sergio Basurto wrote: > > Can anyone explain how I can read input to a bash > > script through a pipe? > > You should use exec like the following simple example: > > #!/bin/bash > > exec 6<&0 # Link file descriptor #6 with stdin. > > read a1 # read if

Re: Reading input piped to a bash script

2004-10-18 Thread Sergio Basurto
On Mon, 18 Oct 2004 19:51:49 +0200, Olle Eriksson wrote: > 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

Re: Reading input piped to a bash script

2004-10-18 Thread Mason Loring Bliss
On Mon, Oct 18, 2004 at 07:51:49PM +0200, Olle Eriksson wrote: > 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" Assuming "blabla" is a file name: if [ -z "$1"