aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bashrc')
-rw-r--r--bash/bashrc9
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