Question: ruby vs. ksh

PPS: How do I do

chown -R user:grp dir

in Ruby?

Perhaps the appropriate sprinkling of cmd..... would be best in these cases?

David Douthitt
CUNA & Affiliates
UNIX Systems Administrator
ddouthitt@cuna.coop

DDouthitt@cuna.coop 7/1/02 6:20PM >>>

I don’t feel I’ve been giving Ruby its fair share :slight_smile:

Since I’ve been writing in ksh for a lot more years (even before I used it as my interactive shell!), I tend to do things in ksh. I’d like to start using Ruby more.

So, along these lines, I have a question:

Why should I use (or when should I use) ruby over ksh?

(Yes, I mean it :slight_smile:

PS: How do I do mkdir -p in ruby?

David Douthitt graced us by uttering:

PPS: How do I do

chown -R user:grp dir

in Ruby?

File::chown

can also be used for chgrp(1) operations.

Basically, many shell commands can be replaced by the use of commands in
the Kernel, File, or Dir modules.

Perhaps the appropriate sprinkling of cmd..... would be best in
these cases?

If you just create a subshell for every command you lose the benefits
of using ruby in the first place, and you’re worse off than when you
started since you are starting two processes for each command.

As in someone else’ post, if you find your ruby scripts contain little
else than backticks and system() calls, perhaps your script is better
written in an actual shell language.

HTH
Tim Hammerquist

···


I wouldn’t ever write the full sentence myself, but then, I never use
goto either.
– Larry Wall in 199709032332.QAA21669@wall.org