aboutsummaryrefslogtreecommitdiff
path: root/_tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--_tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/_tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md b/_tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md
index 91ab22e..2b434b4 100644
--- a/_tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md
+++ b/_tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md
@@ -150,5 +150,21 @@ Also when reviewing the text of this article, I found that `{ nextfile }` is a
GNU Awk extension. It would be an improvement if `assert-shellcheck.sh` relied
on the POSIX subset of Awk for working correctly.
+## *Update*
+
+After publishing, I could remove `{ nextfile }` and even make the script
+simpler:
+
+```shell
+#!/usr/sh
+set -eu
+
+git ls-files -z | \
+ xargs -0 awk 'FNR==1 && /^#!\// { print FILENAME }' | \
+ xargs shellcheck
+```
+
+Now both the shell and Awk usage are POSIX compatible.
+
[awk-20min]: https://ferd.ca/awk-in-20-minutes.html
[shellcheck]: https://www.shellcheck.net/