aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-05-27 21:24:17 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-05-27 21:24:17 +1200
commit05eac418f012b9d92f1955cab3d19a5cb9aef760 (patch)
treec1554f40058be55c4923c3c9af9d5fa63c5df5fc /sh
parent1a672fccf7d8c9b41e02d86c1f7f39a5d025aaf6 (diff)
downloaddotfiles-05eac418f012b9d92f1955cab3d19a5cb9aef760.tar.gz
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.sh3
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