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