[U-Boot] common, hush: bug (or feature?) with exit

Heiko Schocher hs at denx.de
Fri Sep 7 11:51:37 CEST 2012


Hello,

I try the following script in u-boot
---------------------------------------------------------------------
setenv error 'if true; then
         echo **** ERROR ****
         exit;
fi'

setenv foo echo "****************This should not be printed"
setenv loadubi

setenv updfs 'if true; then
         echo; echo ========== Updating rootfs ==========; echo;
         if run loadubi; then
                 echo ***************loadubi
         else;
                 run error
         fi
fi'

echo ========== start ==========

run updfs
run foo
---------------------------------------------------------------------

running it with:

bpp3> source 80008000
## Executing script at 80008000
========== start ==========

========== Updating rootfs ==========

## Error: "loadubi" not defined
**** ERROR ****
****************This should not be printed
bpp3>

I expected that the script (if loadubi is not defined) exits after
the "echo **** ERROR ****", and do not print the line
"****************This should not be printed"

Is this a feature or a bug in hush shell?

Thanks for any hints!

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list