Skip to content

Instantly share code, notes, and snippets.

@FlorianWolters
Created December 28, 2014 17:57
Show Gist options
  • Save FlorianWolters/3f5bad441360c8a404ae to your computer and use it in GitHub Desktop.
Save FlorianWolters/3f5bad441360c8a404ae to your computer and use it in GitHub Desktop.
Windows `pause` command in *-nix Shell (Bash)
#!/bin/bash
function pause() {
if [ "$#" -eq 0 ]
then
PROMPT="Press any key . . ."
else
PROMPT="$1"
fi
read -n1 -r -p "$PROMPT"
}
# Default behavior.
pause
# Custom prompt.
pause "Press that any key!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment