[U-Boot] [PATCH] common: cli_hush: Do a simple recursive variables parsing

Wolfgang Denk wd at denx.de
Fri Dec 4 21:20:12 CET 2015


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...


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Copy from one, it's plagiarism; copy from two, it's research.


More information about the U-Boot mailing list