diff options
Diffstat (limited to 'bin/hstow')
-rwxr-xr-x | bin/hstow | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -39,8 +39,13 @@ cchars="$(printf '*[\001-\037\177]*')" if ! command -v readlink >/dev/null; then readlink () { # Safe parse of ls(1) output given its POSIX specification. - ls -ld "$1" | tr -s ' ' \ - | cut -d' ' -f9- | cut -c$((4 + $(echo "$1" | wc -m)))- + # + # 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. + ls -ld "$1" \ + | sed -E 's/^[[:blank:]]*([^[:blank:]]+[[:blank:]]+){8}.{'$(( + 3 + $(echo "$1" | wc -m)))'}//' } fi |