Skip to content
Browse files

Added 'cdb' that will 'cd' to a directory higher up in the hierarchy

  • Loading branch information...
1 parent c55f317 commit bf5edc9016d0b7963e59976910810b8f29c36cd1 Derek Wyatt committed
Showing with 12 additions and 0 deletions.
  1. +12 −0 zsh_custom/plugins/regex-dirstack/regex-dirstack.plugin.zsh
View
12 zsh_custom/plugins/regex-dirstack/regex-dirstack.plugin.zsh
@@ -40,3 +40,15 @@ function csd
cd +$num
return $?
}
+
+function cdb
+{
+ local dir="$1"
+ local old="$PWD"
+ local new="$(echo $old | sed -e s%/$dir/.*$%/$dir%)"
+ if [[ "$old" != "$new" ]]; then
+ cd "$new"
+ else
+ echo "That evaluated to squat." 1>&2
+ fi
+}

0 comments on commit bf5edc9

Please sign in to comment.
Something went wrong with that request. Please try again.