Running Linux Command Through Ruby

I wonder if anyone knows how to run Unix/Linux commands from Ruby?

I understand that the Perl counterpart could be sth like the following.

* First I create a perl file example.pl

* Then inside the file I have the desired Linux commands.

#!/usr/local/bin/perl -w `ls -l`; `curl google.com`;

* When I run the file, those Linux commands would be executed.

Just wonder how I can do this in Ruby in Linux environment. Thanks a lot!

exactly the same: by enclosing the command in backticks (`) you'll get the output produced as the return value, and the exit code is in $?

Fred

Very nice. Thanks!