Convert shell script to ruby shell script