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