I have a script. I would like to give this script a quiet mode and a verbose mode.
This is the equivalent of:
if $verbose
then
redirect="> /dev/null"
fi
echo "Verbose mode enabled" $redirect # This doesn't work because the redirect isn't evaluated.
I'd really like a better way of doing this than writing if-elses for every statement affected.
eval could work, but has obvious side effects on other variables.