<feed
    xmlns="http://www.w3.org/2005/Atom"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xml:lang="en">
  <link rel="self"      type="application/atom+xml" href="https://euandre.org/en/til/feed.shell.xml" />
  <link rel="alternate" type="text/html"            href="https://euandre.org/en/til/" hreflang="en" />
  <title>EuAndreh&apos;s website</title>
  <subtitle>TIL</subtitle>
  <id>https://euandre.org/en/til/feed.shell.xml</id>
  <updated>2026-09-13T12:14:51+00:00</updated>
  <author>
    <name>EuAndreh</name>
    <email>eu@euandre.org</email>
  </author>
  <entry xml:lang="en">
    <title type="html">
      Awk snippet: ShellCheck all scripts in a repository
    </title>
    <link type="text/html" rel="alternative" href="https://euandre.org/en/til/2020/12/15/shellcheck-repo.html" title="Awk snippet: ShellCheck all scripts in a repository" />
    <published>
      2020-12-15T00:00:00+00:00
    </published>
    <updated>
      2020-12-16T00:00:00+00:00
    </updated>
    <id>
      https://euandre.org/en/til/2020/12/15/shellcheck-repo.html
    </id>
    <author>
      <name>
        EuAndreh
      </name>
      <email>
        eu@euandre.org
      </email>
    </author>
    <summary type="html">
        &lt;div id=&quot;preamble&quot;&gt;
          &lt;div class=&quot;sectionbody&quot;&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;Inspired by Fred Herbert’s &quot;&lt;a href=&quot;https://ferd.ca/awk-in-20-minutes.html&quot;&gt;Awk in 20 Minutes&lt;/a&gt;&quot;,
              here’s a problem I just solved with a line of Awk: run ShellCheck in all scripts of a repository.&lt;/p&gt;
    </summary>
    <content type="html" xml:base="en/til/2020/12/15/shellcheck-repo.html">
        &lt;div id=&quot;preamble&quot;&gt;
          &lt;div class=&quot;sectionbody&quot;&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;Inspired by Fred Herbert’s &quot;&lt;a href=&quot;https://ferd.ca/awk-in-20-minutes.html&quot;&gt;Awk in 20 Minutes&lt;/a&gt;&quot;,
              here’s a problem I just solved with a line of Awk: run ShellCheck in all scripts of a repository.&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;In my repositories I usually have Bash and POSIX scripts, which I want to keep tidy with &lt;a href=
              &quot;https://www.shellcheck.net/&quot;&gt;ShellCheck&lt;/a&gt;. Here’s the first version of
              &lt;code&gt;assert-shellcheck.sh&lt;/code&gt;:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L1&quot;
     href=&quot;#B1-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L2&quot;
     href=&quot;#B1-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L3&quot;
     href=&quot;#B1-L3&quot;&gt;3&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;#!/bin/sh -eux

find . -type f -name &apos;*.sh&apos; -print0 | xargs -0 shellcheck&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;shellcheck-repo.html.0.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;This is the type of script that I copy around to all repositories, and I want it to be capable of
              working on any repository, without requiring a list of files to run ShellCheck on.&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;This first version worked fine, as all my scripts had the ‘.sh’ ending. But I recently added some
              scripts without any extension, so &lt;code&gt;assert-shellcheck.sh&lt;/code&gt; called for a second version. The
              first attempt was to try grepping the shebang line:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L1&quot;
     href=&quot;#B2-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L2&quot;
     href=&quot;#B2-L2&quot;&gt;2&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;$ grep &apos;^#!/&apos; assert-shellcheck.sh
#!/usr/sh&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;shellcheck-repo.html.1.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;Good, we have a grep pattern on the first try. Let’s try to find all the matching files:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L1&quot;
     href=&quot;#B3-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L2&quot;
     href=&quot;#B3-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L3&quot;
     href=&quot;#B3-L3&quot;&gt;3&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L4&quot;
     href=&quot;#B3-L4&quot;&gt;4&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L5&quot;
     href=&quot;#B3-L5&quot;&gt;5&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L6&quot;
     href=&quot;#B3-L6&quot;&gt;6&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L7&quot;
     href=&quot;#B3-L7&quot;&gt;7&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L8&quot;
     href=&quot;#B3-L8&quot;&gt;8&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L9&quot;
     href=&quot;#B3-L9&quot;&gt;9&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L10&quot;
     href=&quot;#B3-L10&quot;&gt;10&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L11&quot;
     href=&quot;#B3-L11&quot;&gt;11&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L12&quot;
     href=&quot;#B3-L12&quot;&gt;12&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L13&quot;
     href=&quot;#B3-L13&quot;&gt;13&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L14&quot;
     href=&quot;#B3-L14&quot;&gt;14&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L15&quot;
     href=&quot;#B3-L15&quot;&gt;15&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L16&quot;
     href=&quot;#B3-L16&quot;&gt;16&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L17&quot;
     href=&quot;#B3-L17&quot;&gt;17&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L18&quot;
     href=&quot;#B3-L18&quot;&gt;18&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L19&quot;
     href=&quot;#B3-L19&quot;&gt;19&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L20&quot;
     href=&quot;#B3-L20&quot;&gt;20&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L21&quot;
     href=&quot;#B3-L21&quot;&gt;21&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L22&quot;
     href=&quot;#B3-L22&quot;&gt;22&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L23&quot;
     href=&quot;#B3-L23&quot;&gt;23&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L24&quot;
     href=&quot;#B3-L24&quot;&gt;24&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L25&quot;
     href=&quot;#B3-L25&quot;&gt;25&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L26&quot;
     href=&quot;#B3-L26&quot;&gt;26&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L27&quot;
     href=&quot;#B3-L27&quot;&gt;27&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L28&quot;
     href=&quot;#B3-L28&quot;&gt;28&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L29&quot;
     href=&quot;#B3-L29&quot;&gt;29&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;$ find . -type f | xargs grep -l &apos;^#!/&apos;
./TODOs.org
./.git/hooks/pre-commit.sample
./.git/hooks/pre-push.sample
./.git/hooks/pre-merge-commit.sample
./.git/hooks/fsmonitor-watchman.sample
./.git/hooks/pre-applypatch.sample
./.git/hooks/pre-push
./.git/hooks/prepare-commit-msg.sample
./.git/hooks/commit-msg.sample
./.git/hooks/post-update.sample
./.git/hooks/pre-receive.sample
./.git/hooks/applypatch-msg.sample
./.git/hooks/pre-rebase.sample
./.git/hooks/update.sample
./build-aux/with-guile-env.in
./build-aux/test-driver
./build-aux/missing
./build-aux/install-sh
./build-aux/install-sh~
./bootstrap
./scripts/assert-todos.sh
./scripts/songbooks
./scripts/compile-readme.sh
./scripts/ci-build.sh
./scripts/generate-tasks-and-bugs.sh
./scripts/songbooks.in
./scripts/with-container.sh
./scripts/assert-shellcheck.sh&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;shellcheck-repo.html.2.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;This approach has a problem, though: it includes files ignored by Git, such as
              &lt;code&gt;builld-aux/install-sh~&lt;/code&gt;, and even goes into the &lt;code&gt;.git/&lt;/code&gt; directory and finds sample
              hooks in &lt;code&gt;.git/hooks/*&lt;/code&gt;.&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;To list the files that Git is tracking we’ll try &lt;code&gt;git ls-files&lt;/code&gt;:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L1&quot;
     href=&quot;#B4-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L2&quot;
     href=&quot;#B4-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L3&quot;
     href=&quot;#B4-L3&quot;&gt;3&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L4&quot;
     href=&quot;#B4-L4&quot;&gt;4&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L5&quot;
     href=&quot;#B4-L5&quot;&gt;5&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L6&quot;
     href=&quot;#B4-L6&quot;&gt;6&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L7&quot;
     href=&quot;#B4-L7&quot;&gt;7&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L8&quot;
     href=&quot;#B4-L8&quot;&gt;8&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L9&quot;
     href=&quot;#B4-L9&quot;&gt;9&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L10&quot;
     href=&quot;#B4-L10&quot;&gt;10&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L11&quot;
     href=&quot;#B4-L11&quot;&gt;11&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L12&quot;
     href=&quot;#B4-L12&quot;&gt;12&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L13&quot;
     href=&quot;#B4-L13&quot;&gt;13&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B4-L14&quot;
     href=&quot;#B4-L14&quot;&gt;14&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;$ git ls-files | xargs grep -l &apos;^#!/&apos;
TODOs.org
bootstrap
build-aux/with-guile-env.in
old/scripts/assert-docs-spelling.sh
old/scripts/build-site.sh
old/scripts/builder.bats.sh
scripts/assert-shellcheck.sh
scripts/assert-todos.sh
scripts/ci-build.sh
scripts/compile-readme.sh
scripts/generate-tasks-and-bugs.sh
scripts/songbooks.in
scripts/with-container.sh&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;shellcheck-repo.html.3.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;It looks to be almost there, but the &lt;code&gt;TODOs.org&lt;/code&gt; entry shows a flaw in it: grep is looking
              for a &lt;code&gt;&apos;^#!/&apos;&lt;/code&gt; pattern on any part of the file. In my case, &lt;code&gt;TODOs.org&lt;/code&gt; had a
              snippet in the middle of the file where a line started with &lt;code&gt;#!/bin/sh&lt;/code&gt;.&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;So what we actually want is to match the &lt;strong&gt;first&lt;/strong&gt; line against the pattern. We could
              loop through each file, get the first line with &lt;code&gt;head -n 1&lt;/code&gt; and grep against that, but this is
              starting to look messy. I bet there is another way of doing it concisely…​&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;Let’s try Awk. I need a way to select the line numbers to replace &lt;code&gt;head -n 1&lt;/code&gt;, and to stop
              processing the file if the pattern matches. A quick search points me to using &lt;code&gt;FNR&lt;/code&gt; for the
              former, and &lt;code&gt;{ nextline }&lt;/code&gt; for the latter. Let’s try it:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L1&quot;
     href=&quot;#B5-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L2&quot;
     href=&quot;#B5-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L3&quot;
     href=&quot;#B5-L3&quot;&gt;3&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L4&quot;
     href=&quot;#B5-L4&quot;&gt;4&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L5&quot;
     href=&quot;#B5-L5&quot;&gt;5&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L6&quot;
     href=&quot;#B5-L6&quot;&gt;6&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L7&quot;
     href=&quot;#B5-L7&quot;&gt;7&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L8&quot;
     href=&quot;#B5-L8&quot;&gt;8&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L9&quot;
     href=&quot;#B5-L9&quot;&gt;9&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L10&quot;
     href=&quot;#B5-L10&quot;&gt;10&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L11&quot;
     href=&quot;#B5-L11&quot;&gt;11&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L12&quot;
     href=&quot;#B5-L12&quot;&gt;12&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B5-L13&quot;
     href=&quot;#B5-L13&quot;&gt;13&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;$ git ls-files | xargs awk &apos;FNR&amp;gt;1 { nextfile } /^#!\// { print FILENAME; nextfile }&apos;
bootstrap
build-aux/with-guile-env.in
old/scripts/assert-docs-spelling.sh
old/scripts/build-site.sh
old/scripts/builder.bats.sh
scripts/assert-shellcheck.sh
scripts/assert-todos.sh
scripts/ci-build.sh
scripts/compile-readme.sh
scripts/generate-tasks-and-bugs.sh
scripts/songbooks.in
scripts/with-container.sh&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;shellcheck-repo.html.4.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;Great! Only &lt;code&gt;TODOs.org&lt;/code&gt; is missing, but the script is much better: instead of matching
              against any part of the file that may have a shebang-like line, we only look for the first. Let’s put it
              back into the &lt;code&gt;assert-shellcheck.sh&lt;/code&gt; file and use &lt;code&gt;NULL&lt;/code&gt; for separators to
              accommodate files with spaces in the name:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B6-L1&quot;
     href=&quot;#B6-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B6-L2&quot;
     href=&quot;#B6-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B6-L3&quot;
     href=&quot;#B6-L3&quot;&gt;3&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B6-L4&quot;
     href=&quot;#B6-L4&quot;&gt;4&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B6-L5&quot;
     href=&quot;#B6-L5&quot;&gt;5&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;#!/usr/sh -eux

git ls-files -z | \
  xargs -0 awk &apos;FNR&amp;gt;1 { nextfile } /^#!\// { print FILENAME; nextfile }&apos; | \
  xargs shellcheck&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;shellcheck-repo.html.5.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;This is where I’ve stopped, but I imagine a likely improvement: match against only
              &lt;code&gt;#!/bin/sh&lt;/code&gt; and &lt;code&gt;#!/usr/bin/env bash&lt;/code&gt; shebangs (the ones I use most), to avoid
              running ShellCheck on Perl files, or other shebangs.&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;Also when reviewing the text of this article, I found that &lt;code&gt;{ nextfile }&lt;/code&gt; is a GNU Awk
              extension. It would be an improvement if &lt;code&gt;assert-shellcheck.sh&lt;/code&gt; relied on the POSIX subset of
              Awk for working correctly.&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;sect1&quot;&gt;
          &lt;h2 id=&quot;update&quot;&gt;&lt;em&gt;Update&lt;/em&gt;&lt;a class=&quot;anchor&quot;
             href=&quot;#update&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
          &lt;div class=&quot;sectionbody&quot;&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;After publishing, I could remove &lt;code&gt;{ nextfile }&lt;/code&gt; and even make the script simpler:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B7-L1&quot;
     href=&quot;#B7-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B7-L2&quot;
     href=&quot;#B7-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B7-L3&quot;
     href=&quot;#B7-L3&quot;&gt;3&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B7-L4&quot;
     href=&quot;#B7-L4&quot;&gt;4&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B7-L5&quot;
     href=&quot;#B7-L5&quot;&gt;5&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;#!/usr/sh -eux

git ls-files -z | \
  xargs -0 awk &apos;FNR==1 &amp;amp;&amp; /^#!\// { print FILENAME }&apos; | \
  xargs shellcheck&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;shellcheck-repo.html.6.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;Now both the shell and Awk usage are POSIX compatible.&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
    </content>
  </entry>
  <entry xml:lang="en">
    <title type="html">
      Useful Bash variables
    </title>
    <link type="text/html" rel="alternative" href="https://euandre.org/en/til/2020/11/12/useful-bashvars.html" title="Useful Bash variables" />
    <published>
      2020-11-12T00:00:00+00:00
    </published>
    <id>
      https://euandre.org/en/til/2020/11/12/useful-bashvars.html
    </id>
    <author>
      <name>
        EuAndreh
      </name>
      <email>
        eu@euandre.org
      </email>
    </author>
    <summary type="html">
        &lt;div id=&quot;preamble&quot;&gt;
          &lt;div class=&quot;sectionbody&quot;&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;https://www.gnu.org/software/bash/&quot;&gt;GNU Bash&lt;/a&gt; has a few two letter variables that may be
              useful when typing on the terminal.&lt;/p&gt;
    </summary>
    <content type="html" xml:base="en/til/2020/11/12/useful-bashvars.html">
        &lt;div id=&quot;preamble&quot;&gt;
          &lt;div class=&quot;sectionbody&quot;&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;https://www.gnu.org/software/bash/&quot;&gt;GNU Bash&lt;/a&gt; has a few two letter variables that may be
              useful when typing on the terminal.&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;sect1&quot;&gt;
          &lt;h2 id=&quot;the-text-of-the-last-command&quot;&gt;&lt;code&gt;!!&lt;/code&gt;: the text of the last command&lt;a class=&quot;anchor&quot;
             href=&quot;#the-text-of-the-last-command&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
          &lt;div class=&quot;sectionbody&quot;&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;The &lt;a href=&quot;https://www.gnu.org/software/bash/manual/bash.html#Event-Designators&quot;&gt;&lt;code&gt;!!&lt;/code&gt;
              variable&lt;/a&gt; refers to the previous command, and I find useful when following chains for symlinks:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L1&quot;
     href=&quot;#B1-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L2&quot;
     href=&quot;#B1-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L3&quot;
     href=&quot;#B1-L3&quot;&gt;3&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L4&quot;
     href=&quot;#B1-L4&quot;&gt;4&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L5&quot;
     href=&quot;#B1-L5&quot;&gt;5&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;$ which git
/run/current-system/sw/bin/git
$ readlink $(!!)
readlink $(which git)
/nix/store/5bgr1xpm4m0r72h9049jbbhagxdyrnyb-git-2.28.0/bin/git&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;useful-bashvars.html.0.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;It is also useful when you forget to prefix &lt;code&gt;sudo&lt;/code&gt; to a command that requires it:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L1&quot;
     href=&quot;#B2-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L2&quot;
     href=&quot;#B2-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L3&quot;
     href=&quot;#B2-L3&quot;&gt;3&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L4&quot;
     href=&quot;#B2-L4&quot;&gt;4&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L5&quot;
     href=&quot;#B2-L5&quot;&gt;5&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;$ requires-sudo.sh
requires-sudo.sh: Permission denied
$ sudo !!
sudo ./requires-sudo.sh
# all good&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;useful-bashvars.html.1.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;Bash prints the command expansion before executing it, so it is better for you to follow along what it
              is doing.&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;sect1&quot;&gt;
          &lt;h2 id=&quot;_-most-recent-parameter&quot;&gt;&lt;code&gt;$_&lt;/code&gt;: most recent parameter&lt;a class=&quot;anchor&quot;
             href=&quot;#_-most-recent-parameter&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
          &lt;div class=&quot;sectionbody&quot;&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;The &lt;a href=&quot;https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters&quot;&gt;&lt;code&gt;$_&lt;/code&gt;
              variable&lt;/a&gt; will give you the most recent parameter you provided to a previous argument, which can save
              you typing sometimes:&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class=&quot;listingblock&quot;&gt;
              &lt;div class=&quot;content&quot;&gt;
                &lt;table&gt;
                  &lt;tbody&gt;
                    &lt;tr&gt;
                      &lt;td&gt;
                        &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L1&quot;
     href=&quot;#B3-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L2&quot;
     href=&quot;#B3-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L3&quot;
     href=&quot;#B3-L3&quot;&gt;3&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L4&quot;
     href=&quot;#B3-L4&quot;&gt;4&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L5&quot;
     href=&quot;#B3-L5&quot;&gt;5&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L6&quot;
     href=&quot;#B3-L6&quot;&gt;6&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B3-L7&quot;
     href=&quot;#B3-L7&quot;&gt;7&lt;/a&gt;&lt;/pre&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                        &lt;pre&gt;# instead of...
$ mkdir -p a/b/c/d/
$ cd a/b/c/d/

# ...you can:
$ mkdir -p a/b/c/d/
$ cd $_&lt;/pre&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/tbody&gt;
                &lt;/table&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;paragraph plaintext&quot;&gt;
              &lt;p&gt;&lt;a href=&quot;useful-bashvars.html.2.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;sect1&quot;&gt;
          &lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;a class=&quot;anchor&quot;
             href=&quot;#conclusion&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
          &lt;div class=&quot;sectionbody&quot;&gt;
            &lt;div class=&quot;paragraph&quot;&gt;
              &lt;p&gt;I wouldn’t use those in a script, as it would make the script terser to read, I find those useful
              shortcut that are handy when writing at the interactive terminal.&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
    </content>
  </entry>
  <entry xml:lang="en">
    <title type="html">
      Find broken symlinks with &quot;find&quot;
    </title>
    <link type="text/html" rel="alternative" href="https://euandre.org/en/til/2020/11/08/find-broken-symlink.html" title="Find broken symlinks with &quot;find&quot;" />
    <published>
      2020-11-08T00:00:00+00:00
    </published>
    <id>
      https://euandre.org/en/til/2020/11/08/find-broken-symlink.html
    </id>
    <author>
      <name>
        EuAndreh
      </name>
      <email>
        eu@euandre.org
      </email>
    </author>
    <summary type="html">
        &lt;div class=&quot;paragraph&quot;&gt;
          &lt;p&gt;The &lt;code&gt;find&lt;/code&gt; command knows how to show broken symlinks:&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;listingblock&quot;&gt;
          &lt;div class=&quot;content&quot;&gt;
    </summary>
    <content type="html" xml:base="en/til/2020/11/08/find-broken-symlink.html">
        &lt;div class=&quot;paragraph&quot;&gt;
          &lt;p&gt;The &lt;code&gt;find&lt;/code&gt; command knows how to show broken symlinks:&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;listingblock&quot;&gt;
          &lt;div class=&quot;content&quot;&gt;
            &lt;table&gt;
              &lt;tbody&gt;
                &lt;tr&gt;
                  &lt;td&gt;
                    &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L1&quot;
     href=&quot;#B1-L1&quot;&gt;1&lt;/a&gt;&lt;/pre&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                    &lt;pre&gt;find . -xtype l&lt;/pre&gt;
                  &lt;/td&gt;
                &lt;/tr&gt;
              &lt;/tbody&gt;
            &lt;/table&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;paragraph plaintext&quot;&gt;
          &lt;p&gt;&lt;a href=&quot;find-broken-symlink.html.0.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;paragraph&quot;&gt;
          &lt;p&gt;This was useful to me when combined with &lt;a href=&quot;https://git-annex.branchable.com/&quot;&gt;Git Annex&lt;/a&gt;. Its
          &lt;a href=&quot;https://git-annex.branchable.com/git-annex-wanted/&quot;&gt;&lt;code&gt;wanted&lt;/code&gt;&lt;/a&gt; option allows you to
          have a &quot;sparse&quot; checkout of the content, and save space by not having to copy every annexed file locally:&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;listingblock&quot;&gt;
          &lt;div class=&quot;content&quot;&gt;
            &lt;table&gt;
              &lt;tbody&gt;
                &lt;tr&gt;
                  &lt;td&gt;
                    &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L1&quot;
     href=&quot;#B2-L1&quot;&gt;1&lt;/a&gt;&lt;/pre&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                    &lt;pre&gt;git annex wanted . &apos;exclude=Music/* and exclude=Videos/*&apos;&lt;/pre&gt;
                  &lt;/td&gt;
                &lt;/tr&gt;
              &lt;/tbody&gt;
            &lt;/table&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;paragraph plaintext&quot;&gt;
          &lt;p&gt;&lt;a href=&quot;find-broken-symlink.html.1.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;paragraph&quot;&gt;
          &lt;p&gt;You can &lt;code&gt;find&lt;/code&gt; any broken symlinks outside those directories by querying with Git Annex itself,
          but &lt;code&gt;find . -xtype l&lt;/code&gt; works on other places too, where broken symlinks might be a problem.&lt;/p&gt;
        &lt;/div&gt;
    </content>
  </entry>
  <entry xml:lang="en">
    <title type="html">
      Simple filename timestamp
    </title>
    <link type="text/html" rel="alternative" href="https://euandre.org/en/til/2020/08/12/filename-timestamp.html" title="Simple filename timestamp" />
    <published>
      2020-08-12T00:00:00+00:00
    </published>
    <id>
      https://euandre.org/en/til/2020/08/12/filename-timestamp.html
    </id>
    <author>
      <name>
        EuAndreh
      </name>
      <email>
        eu@euandre.org
      </email>
    </author>
    <summary type="html">
        &lt;div class=&quot;paragraph&quot;&gt;
          &lt;p&gt;When writing Jekyll posts or creating log files with dates on them, I usually struggle with finding a
          direct way of accomplishing that. There’s a simple solution: &lt;code&gt;date -I&lt;/code&gt;.&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;listingblock&quot;&gt;
    </summary>
    <content type="html" xml:base="en/til/2020/08/12/filename-timestamp.html">
        &lt;div class=&quot;paragraph&quot;&gt;
          &lt;p&gt;When writing Jekyll posts or creating log files with dates on them, I usually struggle with finding a
          direct way of accomplishing that. There’s a simple solution: &lt;code&gt;date -I&lt;/code&gt;.&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;listingblock&quot;&gt;
          &lt;div class=&quot;content&quot;&gt;
            &lt;table&gt;
              &lt;tbody&gt;
                &lt;tr&gt;
                  &lt;td&gt;
                    &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L1&quot;
     href=&quot;#B1-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B1-L2&quot;
     href=&quot;#B1-L2&quot;&gt;2&lt;/a&gt;&lt;/pre&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                    &lt;pre&gt;./my-program.sh &amp;gt; my-program.$(date -I).log
cp post-template.md _posts/$(date -I)-post-slug.md&lt;/pre&gt;
                  &lt;/td&gt;
                &lt;/tr&gt;
              &lt;/tbody&gt;
            &lt;/table&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;paragraph plaintext&quot;&gt;
          &lt;p&gt;&lt;a href=&quot;filename-timestamp.html.0.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;paragraph&quot;&gt;
          &lt;p&gt;Using this built-in GNU/Linux tool allows you to &lt;code&gt;touch $(date -I).md&lt;/code&gt; to readily create a
          &lt;code&gt;2020-08-12.md&lt;/code&gt; file.&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;paragraph&quot;&gt;
          &lt;p&gt;I always had to read &lt;code&gt;man date&lt;/code&gt; or search the web over and over, and after doing this
          repeatedly it became clear that both &lt;code&gt;date -I&lt;/code&gt; and &lt;code&gt;date -Is&lt;/code&gt; (&lt;code&gt;s&lt;/code&gt; here
          stands for seconds) are the thing that I’m looking for 95% of the time:&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;listingblock&quot;&gt;
          &lt;div class=&quot;content&quot;&gt;
            &lt;table&gt;
              &lt;tbody&gt;
                &lt;tr&gt;
                  &lt;td&gt;
                    &lt;pre class=&quot;lineno&quot;&gt;&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L1&quot;
     href=&quot;#B2-L1&quot;&gt;1&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L2&quot;
     href=&quot;#B2-L2&quot;&gt;2&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L3&quot;
     href=&quot;#B2-L3&quot;&gt;3&lt;/a&gt;
&lt;a class=&quot;code-line-anchor&quot;
     id=&quot;B2-L4&quot;
     href=&quot;#B2-L4&quot;&gt;4&lt;/a&gt;&lt;/pre&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                    &lt;pre&gt;# inside my-program.sh
echo &quot;Program started at $(date -Is)&quot;
# output is:
# Program started at 2020-08-12T09:04:58-03:00&lt;/pre&gt;
                  &lt;/td&gt;
                &lt;/tr&gt;
              &lt;/tbody&gt;
            &lt;/table&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;paragraph plaintext&quot;&gt;
          &lt;p&gt;&lt;a href=&quot;filename-timestamp.html.1.txt&quot;&gt;plaintext&lt;/a&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;paragraph&quot;&gt;
          &lt;p&gt;Both date formats are hierarchical, having the bigger time intervals to the left. This means that you can
          easily sort them (and even tab-complete them) with no extra effort or tool required.&lt;/p&gt;
        &lt;/div&gt;
    </content>
  </entry>
</feed>
