Skip to contentSkip to conversation

common, hush: bug (or feature?) with exit

U-Boot Heiko Schocher 2 participants 3 messages Sep 7, 2012

lore
Share & tools
lore
#0 lore raw

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

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#1 lore raw

Hi Heiko,

Quoted 8 lines · Heiko Schocher

I try the following script in u-boot
---------------------------------------------------------------------
setenv error 'if true; then

        echo **** ERROR ****
        exit;

fi'

don't know if it helps but AFAIK you need a semicolon to seperate the echo and the exit command.

Regards
Holger

#2 lore raw

Hello Holger,

Quoted 12 lines · Holger Brunck

Hi Heiko,

Quoted 8 lines · Heiko Schocher

I try the following script in u-boot
---------------------------------------------------------------------
setenv error 'if true; then

         echo **** ERROR ****
         exit;

fi'

Quoted 2 lines

don't know if it helps but AFAIK you need a semicolon to seperate the echo and the exit command.

Thanks, but that did not help :-(

bye,
Heiko

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