help-bash
[Top][All Lists]
Advanced

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

Quiet version of pushd/popd


From: John Hanks
Subject: Quiet version of pushd/popd
Date: Wed, 21 Apr 2021 13:13:20 -0500

Hi,

It's always been a mystery to me why pushd/popd don't have a -q option to
silence output. I tend to use them like:

pushd /path/to/go/to > /dev/null 2>&1
    code for this spot
    pushd /other/path/to/go/to > /dev/null 2>&1
        code for this spot
    popd > /dev/null 2>&1
popd > /dev/null 2>&1

With the indention in my scripts making visual blocks to distinguish what
location is "active".

Is there a shorter?, more concise?, better?, easier?, recommended? way to
get these to work silently? Also just curious what the reasoning is for why
there isn't a flag to make them silent. This works fine for me now, it's
just not very nice to look at and my best idea has been to make
functions my_pushd and my_popd which wrap them and silence the output, but
really not fond of the name change when doing that.

Best,

griznog


reply via email to

[Prev in Thread] Current Thread [Next in Thread]