From: Bertram Scharpf Date: 2007-09-21T02:12:09+09:00 Subject: Re: Passing var to anoter script Hi, Am Donnerstag, 20. Sep 2007, 23:06:07 +0900 schrieb Michal Sza: > I'm working on script using Watir class where I want to pass variable of > Watir class to another script and I'm getting an error saying "syntax of > the command is invalid', but when I pass any other variable it works > fine. > > Not working ex. > main.rb: > require 'watir' > $ie = Watir::IE.attach(:title,/Appli.*/) > system("ruby \"popi.rb\" #{$ie}") This is not a Ruby but a shell issue. Use system "ruby", "popi.rb", $ie Further, command arguments may only be strings. If you really need to do this anyway you could marshal the object: ----sub.rb class C ; end c = Marshal.load ARGV.shift puts c.inspect ---------- ----main.rb class C ; end c = C.new system "ruby", "sub.rb", Marshal.dump(c) ----------- I doubt whether objects that are connected to processes outside could be marshalled at all. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de