Created
March 31, 2016 01:26
-
-
Save VeryCrazyDog/b0c0a1379831b2b920be69f8d8f7b3fc to your computer and use it in GitHub Desktop.
Shell script template with confirmation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
read -r -p "Are you sure you want to continue? [y/N] " response | |
# Convert to lower case | |
response=${response,,} | |
if [[ ! $response =~ ^(yes|y)$ ]] | |
then | |
exit 0 | |
fi | |
# --------- Execution --------- | |
echo Put your script execution here. | |
# --------- End of execution --------- | |
echo Completed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment