Issue #241 invalid

Support 'set -u' in shell scripts

Joseph Lorenzini
created an issue

In the, there are various checks for the existence of local variables. If not found, the script sets them.

For example:

if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ] then VIRTUALENVWRAPPER_PYTHON="$(command \which python)" fi

If you create a shell script and have 'set -u' in it, then sourcing fails with an unbound error. set -u is a best practice in shell scripts to avoid common scripting errors with unbound variables. It would a nice improvement to support it.

To do this, I propose that we switch the checking from a local variable to environment variable using the printenv command.

For example:

if ! $(printenv VIRTUALENVWRAPPER_PYTHON) then export VIRTUALENVWRAPPER_PYTHON="$(command \which python)" fi

Comments (1)

  1. Log in to comment