logoalt Hacker News

tremontoday at 2:27 PM1 replyview on HN

For anything more complex than linear shell scripting, I prefer ruby --disable-gems these days. As you say, Python is horrible for composing and executing shell commands, but Ruby's FileUtils#sh (combined with %W{} array literals, %x{} output capturing and regular #{} string interpolation) provides a pretty low-impedance interface.


Replies

zbentleytoday at 5:47 PM

FileUtils#sh doesn't exist:

    ruby --disable-gems -e 'require "FileUtils"; FileUtils::sh("ls")'

    -e:1:in `<main>': undefined method `sh' for FileUtils:Module (NoMethodError)