读循环中是/否选项,不工作 [英] Reading Yes/No Option inside the loop, Does not work
本文介绍了读循环中是/否选项,不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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安装脚本。
==> This script does not work. It does not "wait" for the yes or not option. Please I want this script to work. Please let me know, how do modify this. I have seen this kind of similar things in many linux installation scripts.
推荐答案
我没有测试过这一点,但应该工作,
I have not tested this but should work,
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
这篇关于读循环中是/否选项,不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文