3 ms·
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:/
by jwilk 5y ago
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 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.