There is a program like this:
while true
do
echo 'Your pass: '
read password
if [ $password == 'qwerty' ]; then
echo 'Nice!'
break
fi
done
I can use xargs only if the program has arguments. But in this case ./program.sh password doesn't work.
I have a list of password and I need to send them in loop to this program.
xargs -a list ./program.sh doesn't work.
Nice!if the user entersqwerty, but also if they enter" qwerty "(leading or trailing space or tabs with the default value of$IFS) orq\w\e\r\t\y... See Understanding "IFS= read -r line", and also if they enter-d / -o yas your forgot to quote$password.stty -echobefore thereadandstty echoafter it, so the password is not displayed in the terminal.