How to get shell commands working through ruby?

Hi all,

I am a newbie currently trying to execute shell commands from ruby instead of a shell script.(This method is conceived only for solaris so no issues with porting to other OS and all)
Eg:
Consider the command 'ls"
with a shell script ,I would use it like this
bash# ls
<all the contents in that dir would be displayed>

Now how do i get to do the same with ruby?

I dont want to use methods like recursively searching the directory and then displaying the contents(through some while loop )
It has to be only "ls", as in i need to make "ls" work on solaris through ruby as it would if it were to be written In a shell script?

Thanks

You can get the listing with ruby, why you want to use ls?

ruby -e'puts Dir["*"]'

Anyway ...

ruby -e'puts `ls`'

Actually ls was just an easy example that i mentioned.
I am actually improvising a few commands through ruby and since am a beginner i have very little idea of programming in ruby.
So just wanted to have an idea.
By the way can you guide me to any good tutorials for beginners

Thanks

Well,
I'm quite new to ruby too, but it's the next language in my personal list (after Perl). All I have for now is Practical Ruby for System Administration (available on Amazon). You can also check the resources listed at hypermetrics.com/rubyhacker/clrFAQ.html#tag12 .

Linux Certification LPIC: Using Shell Commands in Ruby