You can redirect the standard stdin through module 3 to save it inside the pipeline:
{ cat notify-finished | while read line; do read -u 3 input echo "$input" done; } 3<&0
By the way, if you really use cat in this way, replace it with redirection, and everything will become even simpler:
while read line; do read -u 3 input echo "$input" done 3<&0 <notify-finished
Gordon Davisson Jul 31 '11 at 4:44 2011-07-31 04:44
source share