[clug] Command of the Hour

Alex Osborne ato at meshy.org
Mon Nov 17 03:31:35 GMT 2008


Peter Barker wrote:
> On Mon, 17 Nov 2008, Francis Markham wrote:
> 
>> Anyone know a way to suppress bash's pushd from printing out the stack 
>> every
>> time it is called?
> 
> pbarker at apiomerus:~$ pushd /tmp
> /tmp ~
> pbarker at apiomerus:/tmp$ pushd ~ >/dev/null
> pbarker at apiomerus:~$

And if you want to suppress it every time, wrap it in a function that 
redirects stdout to /dev/null:

pushd() {
   builtin pushd "$@" > /dev/null
}

(The "builtin" is necessary to prevent the function calling itself and 
recursing infinitely.)


More information about the linux mailing list