Created
October 14, 2009 13:45
-
-
Save costa/210085 to your computer and use it in GitHub Desktop.
petter cd
This file contains hidden or 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
# Unfortunately, some tools, e.g. rvm (https://beginrescueend.com/), hook to cd, but not to pushd/popd. Not a problem! | |
pushd() { builtin pushd "$@" && cd .; } | |
popd() { builtin popd "$@" && cd .; } | |
pd() { | |
if [ "$#" -eq "0" ] | |
then if popd &> /dev/null && pwd > ~/.pd; then :; else pd "`cat ~/.pd`"; fi | |
else pushd "$1" &> /dev/null && pwd > ~/.pd | |
fi | |
} | |
mpd() { mkdir -p "$@" && pd "${!#}"; } # TODO find out about that last argument |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment