How to use "read" in Busybox v1.1.1 ?

Michael Conrad mconrad at intellitree.com
Thu May 14 15:51:55 UTC 2015


On 5/14/2015 11:33 AM, Mike Yates wrote:
> On 13 May 2015 at 16:27, Michael Conrad <mconrad at intellitree.com> wrote:
>> On 5/13/2015 7:45 AM, Mike Yates wrote:
>>> read -p "Enter name: " $name
>>>
>>> I have found that the "$" is the issue - Busybox will only accept a
>>> variable name without it, while Bash accepts either, or the null
>>> variable.
>> I think you have some other error in your script giving this illusion.
> No, I do not  - the command line I gave is now working just fine,
> without the "$".
> I have tested everything at the command-line anyway.
> I had been trying a null or existing (but unassigned) variable, as
> used in Bash, while Busybox v1.1.1 only accepts new or assigned
> variables.

You are using some strange terminology here.  What is a null variable? 
an "existing but unassigned" variable?  AFAIK the shell doesn't have 
these concepts.  If the variable exists it must have a value, though it 
could be an empty string.

> I mean "read", "read $v" and "read v" all work in Bash, but only "read
> v" in Ash (Busybox).

By your own examples below, "read $v" does *not* work in bash. Unless 
your definition of "work" is "doesn't throw an error" but it clearly 
doesn't store the value in $v.

-Mike C.


More information about the busybox mailing list