From: Wolfgang Denk Date: Thu, 13 Feb 2020 16:55:14 +0100 Subject: [PATCH] RFC: nvedit: support doing one (extra) expansion of the value in "env set" In-Reply-To: References: <20200205010812.20373-1-rasmus.villemoes@prevas.dk> <20200211163055.30A262403FE@gemini.denx.de> <20200212113848.997CB240057@gemini.denx.de> Message-ID: <20200213155514.C4DA1240057@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 Rasmus, In message you wrote: > > I'm sorry, I see I mistyped in my example above, it should have been > > if test $slot = "A" ; setenv result $BOOT_A_LEFT ... > > as should hopefully be clear from the original post and the eval > examples. So to reiterate, the problem is to get the contents (or value, > if you will) of the BOOT_A_LEFT variable into the result variable, not > setting result to the string "BOOT_A_LEFT" - but with the wrinkle that > BOOT_A_LEFT is generated programmatically, so the code cannot literally > mention BOOT_A_LEFT anywhere. Didn't I show this in my second, expanded example? I suggest you provide a working example of shell code (say, bash, if you like) to demonstrate what you really have in mind. It seems I have problems understanding your verbal description. > So just as print[env] takes the name of a variable and shows the > name=value string, and one can thus say "printenv BOOT_${slot}_LEFT" as > you did in your extended example, I could do > > env get result BOOT_${slot}_LEFT > > and get the value of the BOOT_${slot}_LEFT variable into result. I still fail to see why you think this cannot be done with just the already existing code. Just use setenv instead of printenv in my example? > Would you be ok with adding such an "env get" with less foot-gun potential? I'm not OK with adding any special-purpose code which can easily be implemented with existing scripting capabilites. And so far I don't see the limitation you are running into. 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 Gew?hnlich glaubt der Mensch, wenn er nur Worte h?rt, es m?sse sich dabei doch auch was denken lassen. -- Goethe, Faust I