Debian Codegraph @

keypress.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # keypress.sh: Detect a user keypress ("hot keys").
3
4 echoscip-shell system . . echo.
5
6 old_tty_settings=$(sttyscip-shell system . . stty. -g) # Save old settings (why?).
7 sttyscip-shell system . . stty. -icanon
8 Keypress=$(headscip-shell system . . head. -c1) # or $(dd bs=1 count=1 2> /dev/null)
9 # on non-GNU systems
10
11 echoscip-shell system . . echo.
12 echoscip-shell system . . echo. "Key pressed was \""$Keypress"\"."
13 echoscip-shell system . . echo.
14
15 sttyscip-shell system . . stty. "$old_tty_settings" # Restore old settings.
16
17 # Thanks, Stephane Chazelas.
18
19 exit 0