Last active
March 14, 2023 15:06
-
-
Save argiopetech/7881413 to your computer and use it in GitHub Desktop.
Snippet to implement the ZSH autopushd functionality in BASH. `dc` (the inverse of `cd`) and `flip` utilities are included. `cd` is silent and behaves as the builtin with no argument. `dc` and `flip` list directory stack.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit to http://unix.stackexchange.com/a/4291 for the cd() implementation. | |
alias dc='popd' | |
alias flip='pushd' | |
function cd() | |
{ | |
if [ $# -eq 0 ]; then | |
DIR="${HOME}" | |
else | |
DIR="$1" | |
fi | |
builtin pushd "${DIR}" > /dev/null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment