[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

instance variable into call linux command

Luiz Macchi

2/27/2008 2:12:00 PM

Hi all,
I need to call a Linux command from ruby app to print a text file ! so
i´d like to put a instance variable (@printer_name) into the command
!

for example:

def imprimir
`lpr -P@printer_name /tmp/impressao.txt`
end


how to do this ? it dont recognize the variable...

if i put the name of printer instead it runs

thanks any help
--
Posted via http://www.ruby-....

3 Answers

Arlen Cuss

2/27/2008 2:17:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

Hi.

>> @a = "joe"
=> "joe"
>> `ls #{@a}`
ls: joe: No such file or directory
=> ""
>>

Use the string interpolation #{ruby code here}.

Arlen

The Peeler

6/10/2013 12:44:00 PM

0

On Sun, 09 Jun 2013 21:11:07 -0700, The Rectum, the resident psychopath of
sci and scj, FAKING his time zone again and IMPERSONATING his master, The
Peeler, wrote:

>>Here it is in it's entirety. I can't understand why someone broke it
>>into 3 parts. It's put out by the Department of War and it is
>>automatically Public Domain.
>>
>>I enjoyed it. Thanks for putting it to my attention.
>
> Stupid twerp!
> <tsk>

Stop projecting, The Rectum!

--
bozo about "The Rectum":
"you come to us on your knees everyday, revd, begging for any kind of
attention you can get just like the sodomized attention-whore you are"
MID: <c8ae83dc-f281-4856-94ad-574326b50cb6@kn5g2000pbb.googlegroups.com>

The Peeler

6/10/2013 3:18:00 PM

0

On Mon, 10 Jun 2013 14:44:19 +0200, The Peeler
<finishingoff@themoronicRevd.invalid> wrote:

>On Sun, 09 Jun 2013 21:11:07 -0700, The Rectum, the resident psychopath of
>sci and scj, FAKING his time zone again and IMPERSONATING his master, The
>Peeler, wrote:
>
>>>Here it is in it's entirety. I can't understand why someone broke it
>>>into 3 parts. It's put out by the Department of War and it is
>>>automatically Public Domain.
>>>
>>>I enjoyed it. Thanks for putting it to my attention.
>>
>> Stupid twerp!
>> <tsk>
>
>Stop me projecting, The Rectum!

I, TRY Grik anus! <G>