News for hackers. Stuff that matters.
Re:Perl code that is syntactically correct only on Fridays by jwilk on Wednesday February 16, 2022 @12:22PM (#30362718)
You could check syntax of the whole file (even the unreachable parts) with the -n option.

But that's not bulletproof; consider this code (adapted from <https://hal.archives-ouvertes.fr/hal-01513750/document>):

  if [ $(date +%u) -eq 5 ]
  then
      alias maybe=''
  else
      alias maybe=:
  fi
  maybe for x in; do :; done
"sh -n" always reports syntax error, even thought the script syntax is correct on Fridays.

There are no comments on this comment yet.