Convert script from shell to ruby.