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