Skip to content

Instantly share code, notes, and snippets.

@petergi
Last active July 23, 2024 16:20
Show Gist options
  • Select an option

  • Save petergi/bad72c6913cf23e9821aa5394bd8f6e5 to your computer and use it in GitHub Desktop.

Select an option

Save petergi/bad72c6913cf23e9821aa5394bd8f6e5 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Would you like to 'x' [Y/n]?"
read ans
if [[ -z "$ans" ]] || [[ $ans = [Yy] || $ans = yes || $ans = Yes || $ans = YES ]]; then
echo "Place the 'yes' action here."
else
if [[ $ans = [Nn] || $ans = no || $ans = No || $ans = NO ]]; then
echo "Place the 'no' action here."
else
echo "Invalid option. Exiting."
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment