Contribution: Checking for single Key press with Busybox ash

Harald Becker ralda at
Sat Jul 13 23:25:52 UTC 2013

Hi Denys !

On 14-07-2013 00:54 Denys Vlasenko <vda.linux at>

>"read -r -t2 -n1 KEY" ?
>The downside is that -tSECONDS -nMAXLEN are extensions,
>not a standard.

I know about this -t Extension, but never see -nMAXLEN ... beside
it's none conformance, dos -nMAX mean that read does not wait
until new line is pressed? I thought read always wait for a NL
char before it returns any data entered into the variable.

The idea behind my example is to have the possibility to check
for single key presses on every kind of tty and to catch even
special function key presses witch produce multi character
sequences. What about read when special control codes are
entered? How do you check for them in a shell script?


More information about the busybox mailing list