Created
May 6, 2011 17:36
-
-
Save wx13/959399 to your computer and use it in GitHub Desktop.
expand paths in history when using 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
function cd_save_hist() { | |
if [ -z "$1" ] | |
then | |
d="$HOME" | |
else | |
d="$1" | |
fi | |
builtin cd "$d" | |
dp=$(pwd) | |
history -s cd ${dp} | |
} | |
alias cd=cd_save_hist | |
alias cd0='builtin cd' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment