Skip to content

Commit

Permalink
[bash] add "upto" directory navigation function
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Fischer committed Nov 25, 2020
1 parent 86dc63d commit 7e5c39d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}

0 comments on commit 7e5c39d

Please sign in to comment.