Compact Ruby code

It is often written, that Ruby programs are small. Not in sense of making small things, but than they are compact. I’ve heard that many times. But this time I’ve rewrote my backup script.

What it does? It backups set of directories with tar and dumps mysql databases into some directory. After that I can rsync it to backup host.

Old script was written in shell (bash to be exact) and new one in Ruby. Results are as follow:

# wc -l
# wc -l rbckp.rb
30 rbckp.rb

Is there some difference, can You spot it? :-)) To be honest script does a bit more, and I suppose that exact Ruby copy would have something about 60 lines… Tomorrow I will finish it and see whether my estimate is right.

Join the Conversation


Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.