return value of read
Mike Frysinger
vapier at gentoo.org
Wed Nov 5 17:38:55 UTC 2008
On Wed, Nov 5, 2008 at 10:46 AM, <beast22 at arcor.de> wrote:
> given the read command
>
> read -t10 dummy
>
> I'd like to distinguish between a timeout (no key hit) and a simple >return<.
> In other shells I do this usually by testing the return value of read:
> It's 0 when a button press occurred and 1 on timeout.
>
> Any ideas how I can handle this here?
>
> BTW: I'm using 1.7.4 and this might be outdated - In that case, to which (minimal!) version I'll have to upgrade?
works fine for me with latest busybox
~ $ read -t 1 f
~ $ echo $?
1
~ $ read -t 1 f
~ $ echo $?
0
-mike
More information about the busybox
mailing list