| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 | #!/bin/shset -euexport TZ=UTCcd testsfailing=0for i in *.testfile; do    t=${i%%.testfile}    printf "Running test: %s ... " "$t"    m=    for j in $(eval echo "${t}"*.magic); do        if [ -f "$j" ]; then            if [ -z "$m" ]; then                m="$j"            else                m="$m:$j"            fi        fi    done    if [ "$m" ]; then        export MAGIC="$m"    else        unset MAGIC    fi    if [ -f "${t}.flags" ]; then        f="-$(cat "${t}.flags")"    else        f=    fi    expect="$(cat "${i%%.testfile}.result")"    # shellcheck disable=SC2086    got="$(file -b $f "$i" 2>/dev/null)"    if [ "$got" = "$expect" ]; then        echo 'pass'    else        cat <<__EOS__FAIL:    expect: $expect    got:    $got__EOS__        failing=$((failing+1))    fidoneif [ "$failing" -gt 0 ]; then    echo "Fail count: $failing"    exit 1fiexit 0
 |