aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bashrc10
1 files changed, 9 insertions, 1 deletions
diff --git a/bashrc b/bashrc
index b033207..722bbd5 100644
--- a/bashrc
+++ b/bashrc
@@ -21,5 +21,13 @@ pathadd ${DOTFILES_LOCATION}/bin
source $DOTFILES_LOCATION/aliases
-#exec xonsh
+# navigate to first parent directory matching a regex
+upto() {
+ if [ -z "$1" ]; then
+ return
+ fi
+
+ local upto=$1
+ cd "${PWD/\/$upto\/*//$upto}"
+}