while read a b c
do
.. (do something) ..
# need user to input something
read X
.. (do some more things) ..
done < file.txtThe 'read X' inside the loop will read data from the file 'file.txt' instead of console.
To solve the problem, simple change the 'read X' into
read X < /dev/console
that forces the script reads the input from the terminal.If you are connecting using SSH, replace /dev/console with your current console device. You can see your current terminal device file by the environment variable $SSH_TTY (for OpenSSH) that usually is /dev/pts/0, /dev/pts/1 and so on.
0 意見:
張貼留言