I have a script with an optional verbosity argument. Depending on its value I want to suppress output (pushd in example below, but in reality other, mostly git commands). Example:
verb=1
# pushd optionally outputs path (works but too long)
if [ $verb ]; then
pushd ..
else
pushd .. > /dev/null
fi
popd > /dev/null # the same if.. would be needed here
What I am looking for is something along:
push .. $cond # single line, outputing somehow controlled directly
popd $cond # ditto
Anybody can help? Thanks,
Hans-Peter