aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-11-04 17:54:23 +1300
committerTom Ryder <tom@sanctum.geek.nz>2013-11-04 17:54:23 +1300
commitb4567bcefd8cc1992b042b209ac15fcc41d5bb05 (patch)
tree45c5e344e99565b6277502d1818cba0c2098ebd7 /bash/bashrc.d
parentMore general approach to options for cd wrapper (diff)
downloaddotfiles-b4567bcefd8cc1992b042b209ac15fcc41d5bb05.tar.gz
dotfiles-b4567bcefd8cc1992b042b209ac15fcc41d5bb05.zip
Forgot to stop using absolute params
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/cd.bash7
1 files changed, 4 insertions, 3 deletions
diff --git a/bash/bashrc.d/cd.bash b/bash/bashrc.d/cd.bash
index 72a3fe0b..fa027e52 100644
--- a/bash/bashrc.d/cd.bash
+++ b/bash/bashrc.d/cd.bash
@@ -12,9 +12,10 @@ cd() {
dirs=("${dirs[@]}" "$arg")
fi
done
- if (($# == 2)); then
- if [[ $PWD == *"$1"* ]]; then
- builtin cd "${opts[@]}" "${PWD/$1/$2}"
+ if ((${#dirs} == 2)); then
+ if [[ $PWD == *"${dirs[0]}"* ]]; then
+ builtin cd "${opts[@]}" \
+ "${PWD/${dirs[0]}/${dirs[1]}}"
else
printf '%s\n' 'bash: cd: could not replace substring' >&2
return 1