while read line
do
read -p "Are you alright? (y/n) " RESP
if [ "$RESP" = "y" ]; then
echo "Here i want to do something, but prompt does not wait for the answer"
else
echo "You need more bash programming"
fi
done < find-spam-send-php-ver2.log
==> 这个脚本不起作用。它不会“等待”是或否选项。 请我希望这个脚本工作。请让我知道,如何修改这个。 我在很多linux安装脚本中都看到过这种类似的东西。
最佳答案
我还没有测试过,但应该可以,
while read line <&3
do
read -p "Are you alright? (y/n):" RESP
if [ "$RESP" = "y" ]; then
echo "Here i want to do something, but prompt does not wait for the answer"
else
echo "You need more bash programming"
fi
done 3< find-spam-send-php-ver2.log
关于linux - 在循环中读取是/否选项,不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27288388/