From: Alex Gutteridge Date: 2007-04-26T15:49:00+09:00 Subject: Re: How to run script file using system command On 26 Apr 2007, at 15:33, Dhiraj Girdhar wrote: > Alex Gutteridge wrote: >> On 26 Apr 2007, at 15:04, Dhiraj Girdhar wrote: >> >>> >>> Please tell me why script file is not running? >> >> If that is really what you ran then you have a space in your command. >> >> Alex Gutteridge >> >> Bioinformatics Center >> Kyoto University > > Please tell me if i have a script file say scriptfile, then how i can > run that file using ruby. > Please explaain with example. I was a bit terse with my previous answer. I was just pointing out that you had a space between the initial '.' and the rest of your command which would cause system() to fail. Here is an example of how to run a script using system(): [alexg@powerbook]/Users/alexg(5): cat test.sh #!/bin/sh echo 'foo' [alexg@powerbook]/Users/alexg(6): ./test.sh foo [alexg@powerbook]/Users/alexg(7): ruby -e "system('./test.sh')" foo Alex Gutteridge Bioinformatics Center Kyoto University