On Jul 12, 4:59 pm, Dave Bass <daveb... / musician.org> wrote:
> Greg Hauptmann wrote:
> > Is ruby up to replacing bash shell scripts for this?  (eg calling
> > commands, eg rsynch, getting responses etc?
>
> Yes, but this is exactly what Perl was developed for originally: a
> scripting language superior to csh, awk, etc. Ruby has its roots in Perl
> syntax, but whether you need its object orientation for system scripting
> is debateable.
>
> On WinXP it seems that Ruby's start-up time is much slower than Perl's.
> I haven't used Ruby much on Linux but I suspect that Perl may be faster
> there too, given that Perl has been well tuned for speed over the years.
>
> Dave
> --
> Posted viahttp://www.ruby-forum.com/.

i.using back-quotes is the easiest way to get the output of Unix
commands from Ruby.

response = `ls`

response will be a string object now containing the result of the 'ls'
command.

ii. x = IO.popen("ls")
    response = IO.read

read documentation for popen, it has options for reading Unix
program's STDOUT & STDERR separately.

iii. system("ls") - this call can be used to run Unix commands. but
their outputs cannot be captured.