From: Wolfgang Denk Date: Fri, 04 Dec 2015 21:20:12 +0100 Subject: [U-Boot] [PATCH] common: cli_hush: Do a simple recursive variables parsing In-Reply-To: <1449255744-25787-1-git-send-email-nm@ti.com> References: <1449255744-25787-1-git-send-email-nm@ti.com> Message-ID: <20151204202012.BB212383C74@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Nishanth Menon, In message <1449255744-25787-1-git-send-email-nm@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.