diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-31 13:04:48 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-31 13:06:46 +1300 |
commit | 32b73502e66a20e638177badfbfbd5a65d0d7383 (patch) | |
tree | 8cc140cc98aeb2a2d5f83a497d76d439ca84f675 /sh | |
parent | Correct error message from sd() (diff) | |
download | dotfiles-32b73502e66a20e638177badfbfbd5a65d0d7383.tar.gz dotfiles-32b73502e66a20e638177badfbfbd5a65d0d7383.zip |
Strip trailing slashes from sd() target
Diffstat (limited to 'sh')
-rw-r--r-- | sh/shrc.d/sd.sh | 8 |
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 |