Skip to content

Instantly share code, notes, and snippets.

@VeryCrazyDog
Created March 31, 2016 01:26
Show Gist options
  • Save VeryCrazyDog/b0c0a1379831b2b920be69f8d8f7b3fc to your computer and use it in GitHub Desktop.
Save VeryCrazyDog/b0c0a1379831b2b920be69f8d8f7b3fc to your computer and use it in GitHub Desktop.
Shell script template with confirmation
#!/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