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

Re: Suppressing pushd output



On 10/08/14 17:15, Reco wrote:
>  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
> 
> 

Thanks Reco, that works (or at least a variant more in my style).
I'm a bit surprised that pushd/popd don't have an option to suppress the
output, but there we go...

Thanks again.
-- 
Tony van der Hoff  | mailto:tony@vanderhoff.org
Ariège, France     |


Reply to: