From 8d9474e3e00ef7f10905fd3e4b64c4cd9dffe063 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 16 Dec 2020 04:03:00 -0300 Subject: Awk TIL: Move shell option to shebang lines in code blocks --- ...2-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to '_tils') 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 }' | \ -- cgit v1.2.3