command interpretation

  • Thread starter Martin Krischik
  • Start date
M

Martin Krischik

Hallo,

I searched high and low to find how "command interpretation" actually
works. But all I found is [1]:

`echo command interpretation with interpolation and backslashes`
%x(echo command interpretation with interpolation and backslashes)

Now, this does not explain what kind of interpolation is done and more
importantly: How to switch interpolation off.

Background: I use ruby on the vms operating system and I want to run the
following test command:

x = ´WRITE SYS$OUTPUT F$TRNLNM("SOURCE")´

But all I get is:

test.ruby:8: warning: parenthesize argument(s) for future version
test.ruby:8: parse error
x = ´WRITE SYS$OUTPUT F$TRNLNM("SOURCE")´
^
From which I deduct that some "magic" is done with the $ character
which I don't want.

Martin
[1]
http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#Interpolation
 
R

Robert Klemme

Hallo,

I searched high and low to find how "command interpretation" actually
works. But all I found is [1]:

`echo command interpretation with interpolation and backslashes`
%x(echo command interpretation with interpolation and backslashes)

Now, this does not explain what kind of interpolation is done and more
importantly: How to switch interpolation off.

Background: I use ruby on the vms operating system and I want to run the
following test command:

x = ´WRITE SYS$OUTPUT F$TRNLNM("SOURCE")´

But all I get is:

test.ruby:8: warning: parenthesize argument(s) for future version
test.ruby:8: parse error
x = ´WRITE SYS$OUTPUT F$TRNLNM("SOURCE")´
^
From which I deduct that some "magic" is done with the $ character
which I don't want.

Martin
[1]
http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#Interpolation

Use system with multiple arguments. I think that should help.

robert
 
B

Brian Candler

Background: I use ruby on the vms operating system and I want to run the
following test command:

x = ´WRITE SYS$OUTPUT F$TRNLNM("SOURCE")´

But all I get is:

test.ruby:8: warning: parenthesize argument(s) for future version
test.ruby:8: parse error
x = ´WRITE SYS$OUTPUT F$TRNLNM("SOURCE")´
^
From which I deduct that some "magic" is done with the $ character
which I don't want.

In the mail you sent, I saw character \264 (octal) where there should be a
backtick. A backtick is \140 (octal), \x60 (hex), 96 (decimal)

Have you tried using %x(...) instead?
 
K

Ken Bloom

Hallo,

I searched high and low to find how "command interpretation" actually
works. But all I found is [1]:

`echo command interpretation with interpolation and backslashes`
%x(echo command interpretation with interpolation and backslashes)

Now, this does not explain what kind of interpolation is done and more
importantly: How to switch interpolation off.

Background: I use ruby on the vms operating system and I want to run the
following test command:

x = ´WRITE SYS$OUTPUT F$TRNLNM("SOURCE")´

But all I get is:

test.ruby:8: warning: parenthesize argument(s) for future version
test.ruby:8: parse error
x = ´WRITE SYS$OUTPUT F$TRNLNM("SOURCE")´
^
From which I deduct that some "magic" is done with the $ character
which I don't want.

What kind of quote is a ´ ? It doesn't work out to be a backquote when I
view it on my Linux system. Unlike perl and the shell, the $ isn't used
for any magic in Ruby strings. (The #{} syntax is used instead.) The
interpreter has decided to parse this as a function call within Ruby, and
I'm guessing that's because your quotes aren't quotes.

--Ken
 
M

Martin Krischik

Brian said:
In the mail you sent, I saw character \264 (octal) where there should be a
backtick. A backtick is \140 (octal), \x60 (hex), 96 (decimal)

Another good reason to retire back ticks.
Have you tried using %x(...) instead?

Indeed that works - thanks!

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top