Turns out dash doesn't support ${string:substibution}. Use printf instead.
authorScott Bronson <b.git@u32.net>
Thu, 20 Mar 2008 08:49:26 +0000 (01:49 -0700)
committerScott Bronson <b.git@u32.net>
Thu, 20 Mar 2008 08:49:26 +0000 (01:49 -0700)
pre-commit.d/30store-metadata

index 5190a2c5c691428c7144fc8060f0266e1f654896..fbd9096fdc070e91baf153db2c5199e2e1e4341b 100755 (executable)
@@ -6,9 +6,9 @@ set -e
 filter_unknown() {
        CMD=$1
        while read line; do
-               if [ "${line:0:8+${#CMD}}" = "$CMD UNKNOWN" ]; then
-                       # error message like "Bad owner for ./ppp/peers"
-                       echo Bad "$2" for "${line:9+${#CMD}}" >&2
+               # if the first n chars of $line equal "$CMD UNKNOWN "...
+               if [ "$(printf %.$((9+${#CMD}))s "$line")" = "$CMD UNKNOWN " ]; then
+                       echo Bad "$2" for "$line" >&2
                else
                        echo "$line"
                fi