Created
July 8, 2018 15:25
-
-
Save mhoffman/c9c9c646802ce2a1fc0f999e07a8f611 to your computer and use it in GitHub Desktop.
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
# always use pushd/popd by default | |
# and if directory turns out to be a file, we open it with vi :-) | |
function cd() { | |
if [ "$#" = "0" ] | |
then | |
pushd ${HOME} > /dev/null | |
elif [ -f "${1}" ] | |
then | |
${EDITOR} ${1} | |
else | |
pushd "$1" > /dev/null | |
fi | |
} | |
# bd 5 goes 5 directories back in history | |
function bd(){ | |
if [ "$#" = "0" ] | |
then | |
popd > /dev/null | |
else | |
for i in $(seq ${1}) | |
do | |
popd > /dev/null | |
done | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment