[U-Boot] [PATCH] common: cli_hush: Do a simple recursive variables parsing
Simon Glass
sjg at chromium.org
Sun Dec 6 17:44:46 CET 2015
Hi,
On 4 December 2015 at 13:20, Wolfgang Denk <wd at denx.de> wrote:
> Dear Nishanth Menon,
>
> In message <1449255744-25787-1-git-send-email-nm at ti.com> you wrote:
>> When we use the following in bootargs:
>> v1=abc
>> v2=123-${v1}
>> echo ${v2}
>> we get 123-${v1}
>> when we should have got
>> 123-abc
>> This is because we do not recursively check to see if v2 by itself has
>> a hidden variable. Fix the same with recursive call.
>>
>> NOTE: this is a limited implementation as the next level variable
>> default assignment etc would not function.
>
> As I wrote in my comment to your previous versionof this patch, I
> think your approach is wrong:
>
> Current behaviour is what a standard shell would do as well:
>
> bash$ v1=abc
> bash$ v2='123-${v1}'
> bash$ echo $v2
> 123-${v1}
>
> I think your change would causes non-standard shell behaviour.
>
> If you want to evaluate variables, you have to do so as part of a
> "run" command...
I find the recursive behaviour much more useful. In particular we have
to jump through all sorts of hoops to build up a command line. It
would be much easier if we could make things recursive. The single
quote example above explicitly stops all substitution - do we need a
way to do that also?
Regards,
Simon
More information about the U-Boot
mailing list