[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Suppressing pushd output



 Hi.

On Sun, 10 Aug 2014 17:03:20 +0200
Tony van der Hoff <tony@vanderhoff.org> wrote:

> DEBUG=1
> if [ $DEBUG -eq 0 ]; then
> 	NULLOUT='>/dev/null'
> fi
> pushd $dir ${NULLOUT}; do_something; popd ${NULLOUT}
> 

Try it like this:

#DEBUG=1
OUT=/dev/null
[ -z "$DEBUG" ] && OUT=/dev/stdout

pushd $dir > $OUT; do_something; popd > $OUT

Reco


Reply to: