I'm currently at /opt
and running a small shell script. My "no" condition works perfectly, however, my yes condition doesn't work, I 'am still at /opt
.
while true; do
read -p "go to log location ?" yn
case $yn in
[Yy]* ) cd /var/tmp/logs; break;;
[Nn]* ) echo "you are @ : " $PWD; break;;
* ) echo "Please answer yes or no.";;
esac
done
Any help ??
.
orsource
. Another answer suggest creating a shell function for the task (which is what I would have done). – Kusalananda May 09 '20 at 22:49while true; do read -p "go to log location ?" yn; case $yn in [Yy]* ) cd /var/tmp/logs; break;; [Nn]* ) echo "you are @ : " $PWD; break;; * ) echo "Please answer yes or no.";; esac done
– bey0nd May 09 '20 at 22:54