Skip to content

Instantly share code, notes, and snippets.

@bfatemi
Created March 16, 2016 05:08
Show Gist options
  • Save bfatemi/961a533d8214dfb9b7f9 to your computer and use it in GitHub Desktop.
Save bfatemi/961a533d8214dfb9b7f9 to your computer and use it in GitHub Desktop.
Snippet to trap a keystroke. Press any key to continue...
#!/bin/bash
readOne () {
tput smso
echo "Press any key to return \c"
tput rmso
oldstty=`stty -g`
stty -icanon -echo min 1 time 0
dd bs=1 count=1 >/dev/null 2>&1
stty "$oldstty"
echo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment