PDA

View Full Version : pushd in quite mode?



bostonaholic
April 1st, 2009, 05:11 PM
Anyone know how I can suppress the output of a pushd? I am running it within a bash script and with so many pushd/popd, the directory stack is becoming so large I don't want to see it on the terminal.

Thanks.

bostonaholic
April 1st, 2009, 05:15 PM
The only thing I have found has been to direct the output to /dev/null


pushd >> /dev/null

That just seems like a hack...

dwhitney67
April 1st, 2009, 05:30 PM
The only thing I have found has been to direct the output to /dev/null


pushd >> /dev/null

That just seems like a hack...

It's not a hack, but the only way I know how to do it too. Btw, you do not need two > symbols; one should do.


pushd $dir > /dev/null
...
popd > /dev/null

bostonaholic
April 1st, 2009, 05:35 PM
It's not a hack, but the only way I know how to do it too. Btw, you do not need two > symbols; one should do.


pushd $dir > /dev/null
...
popd > /dev/null


Thanks for the quick reply. What is the difference between '>' and '>>' ?

dwhitney67
April 1st, 2009, 06:01 PM
Thanks for the quick reply. What is the difference between '>' and '>>' ?

The former writes to the target; the latter appends to it.

WitchCraft
April 2nd, 2009, 01:18 AM
you can also redirect just one stream:
stdin
stdout
stderr

ProgramName 1> /dev/null
ProgramName 2> /dev/null
ProgramName 3> /dev/null

bostonaholic
April 2nd, 2009, 03:11 AM
you can also redirect just one stream:
stdin
stdout
stderr

ProgramName 1> /dev/null
ProgramName 2> /dev/null
ProgramName 3> /dev/null

Thanks but I don't want the entire script to output to "/dev/null". I only want the pushd/popd to do so. If I run the script

./script.sh > /dev/null
then all the output is put to /dev/null = not what I want.

slavik
April 2nd, 2009, 04:20 AM
incorrect ...

stdin is 0 and the char for it is <
stdout is 1 and stderr is 2.

WitchCraft
April 2nd, 2009, 04:45 PM
incorrect ...

stdin is 0 and the char for it is <
stdout is 1 and stderr is 2.

Thanks for the correction, it's starting at 0, you're of course right ;-)