Bash
Friday 30 December 2022

YesNo

1read -p "Do you want to proceed? (y/n) " yn
2
3case $yn in 
4	[yY] ) echo ok, we will proceed;
5		break;;
6	[nN] ) echo exiting...;
7		exit;;
8	* ) echo invalid response;;
9esac

Yes

1read -p "Do you want to proceed? (y/N) " yn
2
3if [[ $yn =~ [yY](es)* ]]
4then
5   echo proceed
6fi

Backlinks