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
Post a Comment