This is my below bash script
#!/bin/bash
verify()
{
while true ;do
read -p "Have you fixed ? Yes/No: " yn
case $yn in
YES|Yes|yes|y|Y)
printf "Hola"
check_status
break
#continue
;;
NO|No|no|n|N)
printf "Please fix"
;;
*)
printf "Please answer yes or no.\n"
;;
esac
done
}
check_status()
{
while IFS=" " read -r rec1 rec2
do
if [ $rec2 == 'up' ]
then
echo "$rec1 is up"
else
echo "$rec1 is down so please fix"
verify
fi
done < <(cut -d " " -f1,2 compute_list)
}
check_status
and my compute list is
abcd up
efgh down
..
And it is always giving
It is not showing the line
Have you fixed ? Yes/No:
But it is showing the below infinetely
Please answer yes or No? Please answer yes or No?
infinite loop it is showing same messages again and again and again
Any help
readbuiltin inverifyfunction is redirected to the output ofcutincheck_statusfunction rather than the user's console input.Try to sayread -p "Have you fixed ? Yes/No: " yn < /dev/ttyinverify.