Pause Shell script until Press Enter in while loop

谁说我不能喝 提交于 2019-12-05 04:23:30

read reads from standard input by default, which is redirected to the file, so it's getting the line from the file. You can redirect back to the terminal:

read -p "Press Enter to continue" </dev/tty

Another option would be to use a different FD for the file redirection

while read -u 3
do
    ...
done 3< test.txt
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!