45.19 A while Loop with Several Loop Control CommandsMost people think the Bourne shell's while loop ( 44.10 ) looks like this, with a single command controlling the loop:
while
But
while echo "Enter command or CTRL-d to quit: \c" read command do ...process
Here's a loop that runs
who
and does a quick search on its output.
If the
grep
returns non-zero status (because it doesn't find
while who > $tempfile grep "$who" $tempfile >/dev/null do ...process $tempfile... done - |
|