How to use "read" in Busybox v1.1.1 ?
Joshua Judson Rosen
jrosen at harvestai.com
Fri May 15 04:17:55 UTC 2015
On 05/14/2015 11:58 PM, Michael Conrad wrote:
> If you want the widest compatibility with shells, simply say "read
> REPLY", and/or actually require the value you read to be "yes" or "y"
> before continuing, which is what most people do.
>
> Also, I like to use "set -e" so that any command which fails will
> exit the shell. The shell's default of continuing after failed
> commands is the dangerous part.
>
> That said, it doesn't seem like a bad idea to add $REPLY support to
> busybox sh if it can be written in a few bytes, which I suspect it
> can.
It's already done upstream--it looks like Denys released this in 1.11.0:
commit 9cd4c76b50b8fde9e21943bcd520168fa9d57290
Author: Denis Vlasenko <vda.linux at googlemail.com>
Date: Wed Jun 18 19:22:19 2008 +0000
ash: fix "shift BIGNUM" and "read with no variable name" bugs.
omg. hush testsuite helps to find bugs in ash! what next?
function old new delta
static.arg_REPLY - 8 +8
readcmd 1023 1021 -2
shiftcmd 129 125 -4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 8/-6) Total: 2 bytes
--
"Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."
More information about the busybox
mailing list