[gPXE-devel] [PATCH] [script] Control flow using if and goto

Shao Miller Shao.Miller at yrdsb.edu.on.ca
Sun Mar 14 15:05:30 EDT 2010


Stefan Hajnoczi wrote:
>
> ...
>   : <label>
>
>   Define a label
>
>   goto <label>
>
>   Jump to label in a script.  Not supported from the shell.
>

Suppose I have the following script:

#!gpxe
set space:hex 20
set colon:string :
set foo:string foo
set mylabel:hex ${colon:hex}:${space:hex}:${foo:hex}
echo Do some stuff
if ${some-condition} goto ${foo:string}
goto end
${mylabel:string}
echo Got to ${foo:string}
: end

I wanted to confirm that this patch's implementation of ': label' could 
never establish a "foo" label due to the expansion and could never 
output "Got to foo" regardless of some-condition.  Is that so?  If so, 
does it matter?  Might anyone wish to dynamically generate labels for 
some reason?

- Shao Miller
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://etherboot.org/pipermail/gpxe-devel/attachments/20100314/6677e04b/attachment.html 


More information about the gPXE-devel mailing list