How would you accomplish this?
if [[ -z $VERBOSE ]]; then
REDIRECT=">/dev/null 2>/dev/null"
fi
echo "Installing Pip packages" # Edited in for clarity
pip install requirements.txt $REDIRECT
echo "Installing other dependency"
<Install command goes here> $REDIRECT
You could redirect all output using
exec
:If you want to restore the output later on in the script you can duplicate the file descriptors:
Another option is to open a file descriptor to either
/dev/null
or to duplicate descriptor1
: