Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iseq on a string with a space??
2016-02-11, 21:15
Post: #1
iseq on a string with a space??
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
Find all posts by this user
Quote this message in a reply
2016-02-11, 21:28
Post: #2
RE: iseq on a string with a space??
(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} ?

Use GitHub Discussions
Visit this user's website Find all posts by this user
Quote this message in a reply
2016-02-11, 22:01
Post: #3
RE: iseq on a string with a space??
(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
Find all posts by this user
Quote this message in a reply
2016-02-11, 22:05
Post: #4
RE: iseq on a string with a space??
(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.

Use GitHub Discussions
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)