In a script, I'd like to read a process output line by line, and get a confirmation from the user. So far I've done this:
mycommand-outputpiped | while (read line)
do
read line
#dostuff
read confirm #oops -> this read the next item from the pipe, not the keyboard
done
So I tried to add:
read confirm < /dev/stdin
But it didn't change the thing, it still reads the next line from the pipe... How should I handle this?
readcommand in both the condition list and the loop body for the variableline?