Suppressing pushd output
Hi,
In my shell (bash) scripts, I occasionally use pushd/popd to descend
into subdirectories;
pushd $dir; do_something; popd
Unfortunately the pushd/popd generate a lot of (mostly) unwanted output,
with no apparent way of suppressing it.
So, my solution is:
pushd $dir >/dev/null; do_something; popd >/dev/null
which has the desired effect, but for debugging, it's useful to
re-enable the output.
I tried, and failed, this:
DEBUG=1
if [ $DEBUG -eq 0 ]; then
NULLOUT='>/dev/null'
fi
pushd $dir ${NULLOUT}; do_something; popd ${NULLOUT}
The $NULLOUT is totally ineffective.
Any suggestions as to why this might be so?
--
Tony van der Hoff | mailto:tony@vanderhoff.org
Ariège, France |
Reply to: