Run shell command and save its output in ruby
Ruby has a great set of tools, but sometimes you’d be better of piping together a few of good old shell commands. Even in this case ruby’s got your back.
There are multiple ways how to execute a command in ruby as you can call
system, but if you want to save the output to variable you can use backticks.
latest_digest_filename = `ls -LR content/ | grep weekly | tail -1`
And now I can easily extract the latest digest number to increment it for a new one.