Bash code generator in JavaScript