#!/bin/sh # Shell lint for the install scripts. Two checks: # 1. POSIX syntax (sh -n) for every .sh we ship. # 2. $VAR or ${VAR} glued to a non-ASCII character, which macOS's /bin/sh # (bash 3.2) reads as part of the variable name: "($X;…" is an unbound # variable there even when X is set, and install.sh runs with set -u. # Write ${X}與… — braces fix it. # Run: make lint-sh set -u cd "$(dirname "$0")/../.." || exit 1 fail=0 for f in install.sh $(find deploy -name '*.sh' | sort); do if sh -n "$f" 2>/tmp/anybot-sh-lint.log; then printf ' ✓ %s\n' "$f" else printf ' ✗ %s\n' "$f"; sed 's/^/ /' /tmp/anybot-sh-lint.log; fail=1 fi done printf '\n' python3 - <<'PY' || fail=1 import glob, re, os, sys pat = re.compile(r'(?