[U-Boot] [BUG] cmd : 'env exists envvar' does not display the existence of environment variable

Wolfgang Denk wd at denx.de
Mon Oct 14 10:36:13 UTC 2019


Dear Adarsh Babu Kalepalli,

you should not flag your postings with a BUG marker if you simply
domn't understand how to use the tools.  Please do this only when
you are really sure there is a misbehaviour.

In message <CAJgxa7cv2GiQpS3HwMgC=uAN88Z0KM5b7Frei_gEik1xC=nqyg at mail.gmail.com> you wrote:
> 
> 'env exists env_varName' does not display the existance
> status of 'env_varName' environment variable.

Which part of the documention states that it should _display_ such a
status?

> env exists name - tests for existence of variable

This says it "tests", but it does say nothing obout outputting any
such information.  The command to output such information is "env
print".

> => printenv ver
> ver=U-Boot 2019.10 (Oct 14 2019 - 00:47:50 -0700)
> => env exists ver
> =>
> -----------------------------------------
> 
> What is the expected Output and where is the result updated??

Above behaviour is absolutely correct.  The command returns a
proper status which can be used in conditionals etc., for example:

U-Boot> env exists foo ; echo RC=$?
RC=1
U-Boot> if env exists bootdelay ; then echo BOOTDELAY exists ; else echo BOOTDELAY does not exist ; fi
BOOTDELAY exists
U-Boot> if env exists bootdelay ; then echo BOOTDELAZ exists ; else echo BOOTDELAZ does not exist ; fi
BOOTDELAZ exists
U-Boot> env exists bootdelay && printenv bootdelay
bootdelay=3


There is no bug.

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
You don't need a weatherman to know which way the wind blows.
                                                          - Bob Dylan


More information about the U-Boot mailing list