Joel Hammer wrote:
> I am trying to pipe input to a bash script, like so:
> echo one two three | script
> 
> The script has this:
> for i in $@
> do
> echo $i
> done

$@ holds positional parameters, not stdin. To read stdin, use read:

--- snip ---
#!/bin/sh
read i
while [ "$i" != "" ]; do
        echo $i
        read i
done
--- snip ---

$ echo one two three | ./x
one two three

Kurt
-- 
Authors are easy to get on with -- if you're fond of children.
                -- Michael Joseph, "Observer"
_______________________________________________
http://linux.nf -- [EMAIL PROTECTED]
Archives, Subscribe, Unsubscribe, Digest, Etc 
->http://linux.nf/mailman/listinfo/linux-users

Reply via email to