Best Practices for Writing Bash Scripts
kvz.io
kvz.io
Besides that, it wouldn't work on at least linux. You'd get the error:
> env: ‘bash -e’: No such file or directory
because of how everything after the first space is taken as one argument in the shebang.
> Surround your variables with {}. Otherwise bash will try to access the $ENVIRONMENT_app variable in /srv/$ENVIRONMENT_app, whereas you probably intended /srv/${ENVIRONMENT}_app.
I think using the braces all the time instead of only as needed is an exaggerated solution. The rule of what's parsed as the identifier is pretty intuitive. `_` is a valid identifier character so the identifier continues. I can't see this mistake not being obvious, especially with syntax highlighting. I think adding braces all the time would just add too much syntax-cruft that would obscure important details.
> __base="$(basename ${__file} .sh)"
They forgot to quote the variable expansion there.
If that makes any sense at all.
The OP probably meant "${NAME:=}" not "${NAME:-}"