Remove the []
around your case conditions, and you probably didn't want the *
either:
#!/bin/bash
a="This is where all the packages will be listed to install"
echo "What do you want to do?"
while true; do
read -p "Enter: install, remove, or cancel: " yn
case $yn in
install ) $a echo "ROS successfully uninstalled"; break;;
remove ) sudo apt-get remove ros-*; break;;
cancel ) exit;;
* ) echo "INVALID ANSWER!...";;
esac
done
The reason they use [yY]*
in other scripts is because they want to match input with lowercase "y" or uppercase "y", followed by any characters, like "Y", "yes", "YES", etc.