Modified to use Bash explicitly. Corrected some quotation mark weirdness that should never have worked but seemed to.