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