[U-Boot-Users] [PATCH] Propagate Error Status to the Shell on fw_printenv Errors
Grant Erickson
gerickson at nuovations.com
Wed May 7 15:56:04 CEST 2008
On 5/7/08 12:10 AM, Wolfgang Denk wrote:
> In message <87myn2ehqm.fsf at denx.de> you wrote:
>>
>>> root at kilauea# fw_printenv -n hostname ipaddr
>>> ## Error: `-n' option requires exactly one argument
>>> root at kilauea# echo $?
>>> 1
>>
>> But I don't understand what the purpose of the "-n" option is?
>
> The purpose seems clear to me - print the value of a variable without
> the name. This can be useful in shell scripts, for example when you
> want to do something like
>
> $ ipaddr=`fw_printenv -n ipaddr`
>
> However, the addition of this feature is undocumented (not mentioned
> in the commit message), and I don;t see why we should restrict it to a
> single variable - it may be useful to print several values here, too,
> for example like that:
>
> $ set `fw_printenv -n netdev ipaddr netmask`
> $ ifconfig $1 $2 netmask $3
>
> [Well, I know that's a bad example because it's missing all error
> checking, but you get the idea.]
The "-n" option is not a new feature. It already existed in the code prior
to my changes.
Per my comments to Markus in a follow-up to his post, I am happy to evaluate
extending the "-n" functionality, but would like to do so as a separate
effort to the submitted patch which, I believe, stands on its own.
Regards,
Grant
More information about the U-Boot
mailing list