how to test if a pipe contains data
Christof Warlich
christof at warlich.name
Mon Jan 23 18:49:56 UTC 2012
Am 23.01.2012 10:10, schrieb Sven-Göran Bergh
> Without questioning you motives there is a dirty line that you may use if you are
> willing to wait 1 sec for the result:
>
> ash -c "busybox timeout -t 1 ash -c 'read -n0'"&> /dev/null
>
> returns 0 on success and 143 on failure/timeout.
>
> However, it IS hackish and I would recommend looking into the C-wrapper solution
> as Laurent suggested.
>
> /Sven
>
Thanks a lot for that! As you may have seen in my other answer, I have to
live with a rather unpleasant occasional reboot anyway, so some hack before
doing that would not hurt too much, and neither does an additional second
waiting time.
More information about the busybox
mailing list