iPXE discussion forum

Full Version: iseq on a string with a space??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
On a Dell server, the ${manufacturer} variable is "Dell Inc.". I cannot figure out a way to do an iseq on this variable, I tried:

iseq ${manufacturer} Dell${}Inc.

But it always evaluates false. Using anything with a space, 'Dell Inc.', "Dell Inc.", Dell\ Inc., etc, always results in syntax error since it is parsed as two arguments.

Any recommendations?

Rob
(2016-02-11 21:15)robzr Wrote: [ -> ]On a Dell server, the ${manufacturer} variable is "Dell Inc.". I cannot figure out a way to do an iseq on this variable, I tried:

iseq ${manufacturer} Dell${}Inc.

But it always evaluates false. Using anything with a space, 'Dell Inc.', "Dell Inc.", Dell\ Inc., etc, always results in syntax error since it is parsed as two arguments.

Any recommendations?

To create a variable that contains a space run
Code:
set sp:hex 20 && set sp ${sp:string}

Now you can run
Code:
iseq ${manufacturer} Dell${sp}Inc.

If it does not work, what is the output of echo ${manufacturer:hexhyp} ?
(2016-02-11 21:28)NiKiZe Wrote: [ -> ]
(2016-02-11 21:15)robzr Wrote: [ -> ]On a Dell server, the ${manufacturer} variable is "Dell Inc.". I cannot figure out a way to do an iseq on this variable, I tried:

iseq ${manufacturer} Dell${}Inc.

But it always evaluates false. Using anything with a space, 'Dell Inc.', "Dell Inc.", Dell\ Inc., etc, always results in syntax error since it is parsed as two arguments.

Any recommendations?

To create a variable that contains a space run
Code:
set sp:hex 20 && set sp ${sp:string}

Now you can run
Code:
iseq ${manufacturer} Dell${sp}Inc.

If it does not work, what is the output of echo ${manufacturer:hexhyp} ?

That worked - thanks! I'm surprised the parser doesn't support at least a backslash escape at the least, must be a very lightweight routine.

Rob
(2016-02-11 22:01)robzr Wrote: [ -> ]I'm surprised the parser doesn't support at least a backslash escape at the least, must be a very lightweight routine.

Implementing support for that would indeed be good, but since that would be a general part of the scripting the question is how many already existing scripts it would break for.
Reference URL's