diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2020-11-25 15:26:10 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2020-11-25 15:26:10 +0100 |
| commit | 7e5c39da0619a452dc307d960d442080f2bfbafb (patch) | |
| tree | 2527630d1db20ac78f1fe7f8e99fc29298d37efa /bashrc | |
| parent | 86dc63d0348942bca7be03de7c1715a938821700 (diff) | |
| download | dotfiles-7e5c39da0619a452dc307d960d442080f2bfbafb.tar.gz dotfiles-7e5c39da0619a452dc307d960d442080f2bfbafb.zip | |
[bash] add "upto" directory navigation function
Diffstat (limited to 'bashrc')
| -rw-r--r-- | bashrc | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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}" +} |
