In computing, pushd and popd are commands used to work with the command line directory stack. They are available on command-line interpreters such as 4DOS, Bash, C shell, tcsh, Hamilton C shell, KornShell, cmd.exe, and PowerShell for operating systems such as DOS, Microsoft Windows, ReactOS, and Unix-like systems.
The popd CommandTo change the directory, do something, and then hop back to the previous directory, you can use pushd and popd together. We'll use pushd to move to a different directory. We'll use popd to discard the topmost directory in the stack and move to the directory in the second position.
The pushd command stores a directory or network path in memory so that it may be accessed at any time.
To store the current directory information in the stack before moving to another directory location, `pushd` command is used in bash. This command works on LIFO (Last In First Out) based. This means, the directory information will be stored at the end of the stack location.
You could add
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
}
to the top of each script. This is probably the minimum amount of work it will take to solve your problem.
In your .profile file (what ever it is called in your system) add:
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
}
export pushd popd
In zsh you can setopt PUSHDSILENT
. Put this in your ~/.zshrc
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With