diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-05-27 21:24:17 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-05-27 21:24:17 +1200 |
commit | 05eac418f012b9d92f1955cab3d19a5cb9aef760 (patch) | |
tree | c1554f40058be55c4923c3c9af9d5fa63c5df5fc /sh | |
parent | More refinements to bd() (diff) | |
download | dotfiles-05eac418f012b9d92f1955cab3d19a5cb9aef760.tar.gz dotfiles-05eac418f012b9d92f1955cab3d19a5cb9aef760.zip |
Add safety to bd()
Handle case if PWD does not start with a slash--a big "Shouldn't
Happen", but easy enough to be worth handling, since it would loop
infinitely otherwise
Diffstat (limited to 'sh')
-rw-r--r-- | sh/shrc.d/bd.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sh/shrc.d/bd.sh b/sh/shrc.d/bd.sh index 1b253e3d..29bde513 100644 --- a/sh/shrc.d/bd.sh +++ b/sh/shrc.d/bd.sh @@ -28,7 +28,8 @@ bd() { case $2 in */"$1"|'') break ;; */) set -- "$1" "${2%/}" ;; - *) set -- "$1" "${2%/*}" ;; + */*) set -- "$1" "${2%/*}" ;; + *) set -- "$1" '' ;; esac done shift |