diff options
author | EuAndreh <eu@euandre.org> | 2020-12-16 04:03:00 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-12-16 04:03:56 -0300 |
commit | 8d9474e3e00ef7f10905fd3e4b64c4cd9dffe063 (patch) | |
tree | 44792a721f81349f3b70533c7b6b6c2c4f08ea7a /_tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md | |
parent | sync-translations.sh: Fix git diff check for Nix build (diff) | |
download | euandre.org-8d9474e3e00ef7f10905fd3e4b64c4cd9dffe063.tar.gz euandre.org-8d9474e3e00ef7f10905fd3e4b64c4cd9dffe063.tar.xz |
Awk TIL: Move shell option to shebang lines in code blocks
Diffstat (limited to '_tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md')
-rw-r--r-- | _tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md | 11 |
1 files changed, 5 insertions, 6 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 cc2e02c..71d10a3 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 @@ -4,6 +4,8 @@ title: 'Awk snippet: ShellCheck all scripts in a repository' date: 2020-12-15 +updated_at: 2020-12-16 + layout: post lang: en @@ -22,8 +24,7 @@ tidy with [ShellCheck][shellcheck]. Here's the first version of `assert-shellcheck.sh`: ```shell -#!/bin/sh -set -eu +#!/bin/sh -eux find . -type f -name '*.sh' -print0 | xargs -0 shellcheck ``` @@ -136,8 +137,7 @@ look for the first. Let's put it back into the `assert-shellcheck.sh` file and use `NULL` for separators to accommodate files with spaces in the name: ``` -#!/usr/sh -set -eu +#!/usr/sh -eux git ls-files -z | \ xargs -0 awk 'FNR>1 { nextfile } /^#!\// { print FILENAME; nextfile }' | \ @@ -158,8 +158,7 @@ After publishing, I could remove `{ nextfile }` and even make the script simpler: ```shell -#!/usr/sh -set -eu +#!/usr/sh -eux git ls-files -z | \ xargs -0 awk 'FNR==1 && /^#!\// { print FILENAME }' | \ |