read a single pushed key by a dash script

Oliver Grawert ogra at ubuntu.com
Sun Nov 6 15:54:16 UTC 2016


hi,

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

ciao
	oli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20161106/66f05ee4/attachment-0001.pgp>


More information about the ubuntu-users mailing list