Gregory Seidman wrote:
> On Fri, Mar 03, 2006 at 12:23:08AM +0900, Greg Johnson wrote:
> } I'm new to RUBY, but am familar with other scripting languages, PHP,
> } Perl, Wscript, etc.   I'd like to be able to run items from the
> shell } such as ls -l > dirlisting.txt.  Just an example.  Can I do
> this? }
> } I would have just used the search on these forums, but unfortuantely
> } when I click Search I get "The page cannot be found".   Hope they
> can } get this fixed so I won't have to ask every little question.
> 
> There are two ways. One way:
> 
> file_list = `ls -l`.scan(/^.*$/)[1..-1]
> file_list.each { |line|
>   puts "permissions for #{line[49..-1]} are #{line[1..9]}"
> }
> 
> The other way:
> 
> system('ls -l > dirlisting.txt')

There are plenty of other ways.

system "ls", "-l"
system "bash", "-c", "ls -l > dirlisting.txt"
....
Dir["*"].each {|f| File.symlink? f and puts f}
....

Cheers

    robert