Skip to content

Yes/No Prompt

Bash
#!/bin/bash

while true; do

read -p "Continue or do not continue? (y/n) " yn

case $yn in
	[yY] ) echo "Continue";
		break;;
	[nN] ) echo "Leaving...";
		exit;;
	* ) echo "Please use Yy or Nn";;
esac

done

echo "Continue Script Here..."
Back to top