Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I write quite a few Ruby utilities (for myself) and this is what I do: use backticks to harness the power of shell utilities, but have Ruby glue to do more complex tasks with those tools.

For example, I recently wrote a quick Ruby script to test various parts of my internet connection (ping default gateway, test DNS resolution, etc) because I was bored and my internet connection was down. I used backticks to do things like grab a nameserver from /etc/resolv.conf and then ping the server, but I had the surrounding Ruby code doing things like parsing the output using regular expressions and doing some logic on the results.

Sure, I could have written the thing in pure bash, but Ruby has better text manipulation capabilities when it comes to things like parsing (in my opinion), and with the backticks, I still was able to harness the power of the shell anyways.

I'm not sure how portable such solutions are, but for a home-grown testing program written on a whim out of boredom, it was certainly enjoyable to have both the power of Ruby and the shell available.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: