From: Dinesh Umanath Date: 2006-05-03T17:28:05+09:00 Subject: Re: Calling Shell Scripts from Ruby ? Hi Shev, Thank for the reply. But my requirement is that i have to call the shell scripts or Unix Commands from Ruby itself, rather than from IRB ?? Because i will be basicall invoking the ruby from Web (Rails)? Thank You.. Guest wrote: >> Thanks for your reply. When you say output = `Unix command`, i did not >> get about how exactly to use it, is it possible to give a simple sample >> examples if you have with you which calls a script ?? > > > > 1) Start irb. Then do this: > 2) cmd_result = `ls` > > # => "acoc-0.7.1.tar.bz2\n (and much more but i edited it out) > > 3) puts cmd_result.class # => String > > 4) Create a shell file such as test.sh, with content like > echo "This is a test" > > 5) `sh test.sh` > > > Do you see the output? > I see it on my system. > > Hope that helped, cheers, shev. -- Posted via http://www.ruby-forum.com/.