aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/bd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh/shrc.d/bd.sh')
-rw-r--r--sh/shrc.d/bd.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/sh/shrc.d/bd.sh b/sh/shrc.d/bd.sh
index 1043a8cb..bf64a9aa 100644
--- a/sh/shrc.d/bd.sh
+++ b/sh/shrc.d/bd.sh
@@ -55,10 +55,13 @@ bd() {
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