From e4b9241441cc0d3204999da7077535452aa7d43c Mon Sep 17 00:00:00 2001 From: Lena Date: Wed, 1 Jul 2026 00:00:00 +0000 Subject: test: print --help from the header comment block The sed line range broke silently whenever the header grew or shrank. Print from line 2 down to the first non-comment line instead, so the usage text tracks the header. --- test | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test b/test index 7ccfc8f..242cee3 100755 --- a/test +++ b/test @@ -24,7 +24,9 @@ cmd="${1:-unit}" case "$cmd" in unit|e2e|all|record|apk) ;; -h|--help) - sed -n '2,14p' "$0" >&2 + # Usage is the header comment block: print from line 2 down to + # the first non-comment line. + awk 'NR > 1 && /^#/ { sub(/^# ?/, ""); print; next } NR > 1 { exit }' "$0" >&2 exit 0 ;; *) echo "usage: $0 [unit|e2e|all|record|apk]" >&2 -- cgit v1.2.3