Skip to content

Instantly share code, notes, and snippets.

@wx13
Created May 6, 2011 17:36
Show Gist options
  • Save wx13/959399 to your computer and use it in GitHub Desktop.
Save wx13/959399 to your computer and use it in GitHub Desktop.
expand paths in history when using cd
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