diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2013-05-26 15:30:13 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2013-05-26 15:30:13 +1200 |
commit | ee7a2230536bb6ef114d3ef8c8042bff03ff9180 (patch) | |
tree | 1098b4301a8e96104a95f15a319ba7fc60efc6a6 /bash | |
parent | Explicit env variable exports (diff) | |
download | dotfiles-ee7a2230536bb6ef114d3ef8c8042bff03ff9180.tar.gz dotfiles-ee7a2230536bb6ef114d3ef8c8042bff03ff9180.zip |
Emulate zsh dir replacement feature
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bashrc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bash/bashrc b/bash/bashrc index 364f17ce..b65f86ff 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -148,6 +148,15 @@ alias gdb='gdb -q' # I always want a unified diff. alias diff='diff -u' +# If given two arguments to cd, replace the first with the second in $PWD +function cd { + if [[ -n "$2" ]]; then + builtin cd "${PWD/$1/$2}" + else + builtin cd "$*" + fi +} + # Attach to existing tmux session rather than create a new one if possible. function tmux { if [[ -n "$*" ]]; then |