From: Bikas De simex Date: 2008-10-02T21:43:59+09:00 Subject: Re: Remotely passing value on system() or %x[] Stefano Crocco wrote: > Alle Wednesday 01 October 2008, Bikas De simex ha scritto: >> unless FileTest.directory?(path) >> >ruby essai0.rb >> Is there any way to transmit remotely this value. I also try net/ssh >> with no succes. >> Thanks in Advance > > Are you aware that string interpolation doesn't happen in single quoted > strings? Since argument to system is a string enclosed in single quotes, > the > command itself is > > 'plink -pw ppp xxx@yyyy /tmp/essai.ksh #{dirc[3]}' > > instead of > > 'plink -pw ppp xxx@yyyy /tmp/essai.ksh PTOTO' > > which, I guess, is what you want. To achieve this, you need to use a > double > quoted string: > > system("plink -pw ppp xxx@yyyy /tmp/essai.ksh #{dirc[3]}") > > I hope this helps > > Stefano Ruby refused to interpolate #{dirc[3]} dispite I have tried the following: system("plink -pw ppp xxx@yyyy /tmp/essai.ksh #{dirc[3]}") system('plink -pw ppp xxx@yyyy /tmp/essai.ksh "#{dirc[3]}"') system("plink -pw ppp xxx@yyyy /tmp/essai.ksh '#{dirc[3]}'") system(plink '-pw ppp xxx@yyyy /tmp/essai.ksh #{dirc[3]}') system(plink "-pw ppp xxx@yyyy /tmp/essai.ksh #{dirc[3]}") system('plink -pw ppp xxx@yyyy /tmp/essai.ksh #{dirc[3]}') Any suggestion please ! Thanks in advance. -- Posted via http://www.ruby-forum.com/.