スクリプトで、プロセスの出力を 1 行ずつ読み取り、ユーザーから確認を取得したいと考えています。これまでのところ、私はこれを行ってきました:
mycommand-outputpiped | while (read line)
do
read line
#dostuff
read confirm #oops -> this read the next item from the pipe, not the keyboard
done
だから私は追加しようとしました:
read confirm < /dev/stdin
しかし、それは物事を変えませんでした、それはまだパイプから次の行を読み取ります...これをどのように処理すればよいですか?