aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/ad.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-01-02 15:19:09 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-01-02 15:19:30 +1300
commit2a29d5e6873ebe0fe46cf7a0bd007f1dd6a5364b (patch)
tree6d3463a3177ce3e2f68b73f2c7579c51ad45c889 /sh/shrc.d/ad.sh
parentBind the calculator key on my keyboard (diff)
downloaddotfiles-2a29d5e6873ebe0fe46cf7a0bd007f1dd6a5364b.tar.gz
dotfiles-2a29d5e6873ebe0fe46cf7a0bd007f1dd6a5364b.zip
Work around newline-stripping in param expansion
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