aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/sd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh/shrc.d/sd.sh')
-rw-r--r--sh/shrc.d/sd.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/sh/shrc.d/sd.sh b/sh/shrc.d/sd.sh
index ce59bf99..4d63b7d6 100644
--- a/sh/shrc.d/sd.sh
+++ b/sh/shrc.d/sd.sh
@@ -72,10 +72,13 @@ sd() {
;;
esac
- # Print the target
- printf '%s\n' "$1"
+ # Print the target with trailing slash to work around newline stripping
+ printf '%s/' "${1%/}"
)"
+ # Remove trailing slash
+ set -- "${1%/}"
+
# If the subshell printed nothing, return with failure
[ -n "$1" ] || return