summaryrefslogtreecommitdiff
path: root/bin/hstow
diff options
context:
space:
mode:
Diffstat (limited to 'bin/hstow')
-rwxr-xr-xbin/hstow5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/hstow b/bin/hstow
index 21cbeca6..311fce2a 100755
--- a/bin/hstow
+++ b/bin/hstow
@@ -43,9 +43,10 @@ if ! command -v readlink >/dev/null; then
# We want the ninth field onwards in awk's sense --
# i.e. collapsing multiple runs of blanks between the first nine
# fields -- but we mustn't collapse blanks from there onwards.
+ n=$((3 + $(echo "$1" | wc -m)))
ls -ld "$1" \
- | sed -E 's/^[[:blank:]]*([^[:blank:]]+[[:blank:]]+){8}.{'$((
- 3 + $(echo "$1" | wc -m)))'}//'
+ | sed -E \
+ "s/^[[:blank:]]*([^[:blank:]]+[[:blank:]]+){8}.{$n}//"
}
fi