Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > command interpretation

Reply
Thread Tools

command interpretation

 
 
Martin Krischik
Guest
Posts: n/a
 
      05-07-2007
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_Pr...#Interpolation
--
Martin Krischik
 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      05-07-2007
On 07.05.2007 12:43, Martin Krischik wrote:
> 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_Pr...#Interpolation


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

robert
 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      05-07-2007
On Mon, May 07, 2007 at 07:45:05PM +0900, Martin Krischik wrote:
> 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?

 
Reply With Quote
 
Ken Bloom
Guest
Posts: n/a
 
      05-07-2007
On Mon, 07 May 2007 12:43:19 +0200, Martin Krischik wrote:

> 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

--
Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/
 
Reply With Quote
 
Martin Krischik
Guest
Posts: n/a
 
      05-08-2007
Brian Candler schrieb:

> On Mon, May 07, 2007 at 07:45:05PM +0900, Martin Krischik wrote:
>> 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)


Another good reason to retire back ticks.

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


Indeed that works - thanks!

Martin
--
Martin Krischik
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different VHDL-interpretation between Xilinx ISE/ModelSimXE? Thomas Thorsen VHDL 2 03-18-2006 12:11 PM
Interpretation of registry log of tweakui produced registry alteration vincemoon@rcn.com ASP .Net 0 01-10-2005 02:53 AM
Scope interpretation - Bug in ModelTech? Wallclimber VHDL 3 05-26-2004 10:48 PM
EXAM 70-226 query and interpretation? Dean Puhalovich MCSE 3 07-18-2003 01:54 PM
jni error message interpretation tupolev Java 2 06-30-2003 02:33 PM



Advertisments