Skip to content

Instantly share code, notes, and snippets.

@ericwastaken
Last active January 2, 2020 21:18
Show Gist options
  • Save ericwastaken/d8878186c94de32093ee402a4da0481c to your computer and use it in GitHub Desktop.
Save ericwastaken/d8878186c94de32093ee402a4da0481c to your computer and use it in GitHub Desktop.
Example of a BASH script that outputs some text then waits for confirmation before proceeding.
#!/bin/bash
echo "Say something here to confirm some action."
echo ""
# Wait for the user to press any KEY to proceed or allow them to Ctrl+C
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'
# Do your work after this... it won't execute if the user does Ctrl+C at the prompt!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment