> -----Original Message-----
> From: list-bounce / example.com 
> [mailto:list-bounce / example.com] On Behalf Of galevsky
> Sent: Wednesday, May 16, 2007 9:23 AM
> To: ruby-talk ML
> Subject: Trouble with system() on SunOS
> 
> Hi all,
> 
> I am facing trouble with a system call on one of my tool: XmlChecker
> 
> 
> * The script
> -- test.rb
> system "echo 'Here is the tool'"
> system "which XmlChecker"
> system "echo '$PATH def'"
> system "echo $PATH"
> system "XmlChecker -V"
> 
> * The execution:
> 
> [578] XmlChecker -V
> v1.9
> [579] ruby -W0 test.rb
> Here is the tool
> /projects/fqdbdatamig/tools/prod/bin//XmlChecker
> $PATH def
> [...]:/projects/fqdbdatamig/tools/prod/bin/:.
> [580]
> 
> Note that I ran the script with -W0 to avoid "warning: 
> Insecure world writable dir /teams/com_fqd_dev/tools, mode 
> 040777" messages.
> 
> What is wrong with that ? The system call does not read the 
> $PATH var ?
> Why 'echo' ran well ?
The first echo of $PATH has $PATH surrounded by single quotes; the shell
will not evaluate $PATH, instead taking it literally.  Encapsulate it in
double quotes (you'll need to escape them so they execute properly), and
it should work as expected.

irb(main):003:0> system "echo \"$PATH def\""
/usr/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/php/bin:/usr/ccs/b
in:/usr/local/mysql/bin def
=> true

(The above was run on a Solaris 10 machine)