Read From Pipe in Bash Script -


i've got bash script ever going invoked via pipe. i'm curious what's best way read data pipe? command like:

$ output_gen | process 

my script process. not homework, learning exercise.

when program receiving data pipeline, it's received via stdin. read stdin, use read builtin. here example:

myprog:

while read -r line;      <something "$line"> done 

command:

printf 'foo\nbar\n' | ./myprog 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -