~ubuntu-branches/ubuntu/trusty/abs-guide/trusty-proposed

« back to all changes in this revision

Viewing changes to abs/keypress.sh

  • Committer: Package Import Robot
  • Author(s): Sandro Tosi
  • Date: 2012-06-03 10:57:27 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20120603105727-rm7frl4feikr2swm
Tags: 6.5-1
* New upstream release
* debian/watch
  - updated
* debian/abs-guide.lintian-overrides
  - updated for new upstream code
* debian/control
  - bump Standards-Version to 3.9.3 (no changes needed)

Show diffs side-by-side

added added

removed removed

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