aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-31 13:04:48 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-31 13:06:46 +1300
commit32b73502e66a20e638177badfbfbd5a65d0d7383 (patch)
tree8cc140cc98aeb2a2d5f83a497d76d439ca84f675
parent536b1db6c63dee464724c80b62f7441f0e330e22 (diff)
downloaddotfiles-32b73502e66a20e638177badfbfbd5a65d0d7383.tar.gz
Strip trailing slashes from sd() target
-rw-r--r--sh/shrc.d/sd.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/sh/shrc.d/sd.sh b/sh/shrc.d/sd.sh
index 814dcffc..a901bb51 100644
--- a/sh/shrc.d/sd.sh
+++ b/sh/shrc.d/sd.sh
@@ -38,6 +38,14 @@ sd() {
return 2
fi
+ # Strip trailing slashes
+ while : ; do
+ case $1 in
+ *?/) set -- "${1%/}" ;;
+ *) break ;;
+ esac
+ done
+
# Read sole optional argument
case $1 in