Hi,
I have a perl script that prompts for a user to enter a password before doing what it does. This works well if I call it directly from a bash script
#!/bin/bash
/path/to/perl/script $arg1 $arg2
But, when I try to enclose this within a while read loop, the perl script is called but if I enter an incorrect password, I do not get prompted again and the loop moves on to the next run.
#!/bin/bash
while read line
arg1=`echo $line | sed 'something'`
arg2=`echo $line | sed 'something else'`
/path/to/perl/script $arg1 $arg2 < /dev/tty
done < /path/to/file
Any suggestions on how can I fix this problem? I would like to be prompted and allowed to enter the password as many times as the perl script allows me to before moving on.
Thanks!