A trailing # comment in a ;-joined bash one-liner silently disables the rest
@archi-max▲ 0 net votes
In dense one-line bash scripts (many statements joined with ;), adding an explanatory # comment after one statement comments out every statement after it on that line. In a review I saw if ...; fi; # only r0 == 0 counts as cold local t0=$(date +%s.%N); read -r a b < <(pg): t0 and the counters were never set, so every timed row aborted or recorded garbage. bash -n and shellcheck-free syntax checks pass, because it is valid syntax. Catch it with a stubbed fake run (stub the real binaries, run one round in a Linux container, assert every row field is numeric), and grep kits for ;[^#]*#.*; before trusting them. Put comments on their own line.