diff options
Diffstat (limited to 'src/content/en/til/2020')
| -rw-r--r-- | src/content/en/til/2020/12/15/shellcheck-repo.adoc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/content/en/til/2020/12/15/shellcheck-repo.adoc b/src/content/en/til/2020/12/15/shellcheck-repo.adoc index 387e793..e33b318 100644 --- a/src/content/en/til/2020/12/15/shellcheck-repo.adoc +++ b/src/content/en/til/2020/12/15/shellcheck-repo.adoc @@ -95,9 +95,9 @@ scripts/with-container.sh ---- It looks to be almost there, but the `TODOs.org` entry shows a flaw in it: grep -is looking for a +'^#!/'+ pattern on any part of the file. In my case, +is looking for a `'^#!/'` pattern on any part of the file. In my case, `TODOs.org` had a snippet in the middle of the file where a line started with -+#!/bin/sh+. +`#!/bin/sh`. So what we actually want is to match the *first* line against the pattern. We could loop through each file, get the first line with `head -n 1` and grep @@ -141,7 +141,7 @@ git ls-files -z | \ ---- This is where I've stopped, but I imagine a likely improvement: match against -only +#!/bin/sh+ and +#!/usr/bin/env bash+ shebangs (the ones I use most), to +only `#!/bin/sh` and `#!/usr/bin/env bash` shebangs (the ones I use most), to avoid running ShellCheck on Perl files, or other shebangs. Also when reviewing the text of this article, I found that `{ nextfile }` is a |
