read a single pushed key by a dash script
ogra at ubuntu.com
Sun Nov 6 15:59:46 UTC 2016
On So, 2016-11-06 at 16:54 +0100, Oliver Grawert wrote:
> On So, 2016-11-06 at 14:25 +0100, Ralf Mardorf wrote:
> > does anybody know a more neat solution, than using bash's read in a
> > dash script?
> > bash -c "read -n1 answer"
> you could try:
> stty raw; REPLY=$(dd bs=1 count=1 2> /dev/null); stty -raw
hmm, even though ... -raw can be evil if you want to be able to ctrl-C
out of your script ...
stty -icanon -echo
REPLY=$(dd bs=1 count=1 2> /dev/null)
stty icanon echo
might be cleverer ...
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 181 bytes
Desc: This is a digitally signed message part
More information about the ubuntu-users