aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_tils/2021-01-17-posix-sh-and-shebangs.md57
-rw-r--r--locale/eo/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po6
-rw-r--r--locale/eo/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po97
-rw-r--r--locale/fr/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po6
-rw-r--r--locale/fr/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po97
-rw-r--r--locale/pt/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po6
-rw-r--r--locale/pt/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po97
-rw-r--r--scripts/spelling/en.txt1
8 files changed, 358 insertions, 9 deletions
diff --git a/_tils/2021-01-17-posix-sh-and-shebangs.md b/_tils/2021-01-17-posix-sh-and-shebangs.md
new file mode 100644
index 0000000..938d1bd
--- /dev/null
+++ b/_tils/2021-01-17-posix-sh-and-shebangs.md
@@ -0,0 +1,57 @@
+---
+
+title: POSIX sh and shebangs
+
+date: 2021-01-17
+
+layout: post
+
+lang: en
+
+ref: posix-sh-and-shebangs
+
+---
+
+As I [keep moving][posix-awk-0] [towards POSIX][posix-awk-1], I'm on the process of migrating all my Bash scripts to POSIX sh.
+
+As I dropped `[[`, arrays and other Bashisms, I was left staring at the first line of every script, wondering what to do: what is the POSIX sh equivalent of `#!/usr/bin/env bash`?
+I already knew that POSIX says nothing about shebangs, and that the portable way to call a POSIX sh script is `sh script.sh`, but I didn't know what to do with that first line.
+
+What I had previously was:
+```shell
+#!/usr/bin/env bash
+set -Eeuo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+```
+
+Obviously, the `$BASH_SOURCE` would be gone, and I would have to adapt some of my scripts to not rely on the script location.
+The `-E` and `-o pipefail` options were also gone, and would be replaced by nothing.
+
+I converted all of them to:
+```shell
+#!/bin/sh -eu
+```
+
+I moved the `-eu` options to the shebang line itself, striving for conciseness.
+But as I changed callers from `./script.sh` to `sh script.sh`, things started to fail.
+Some tests that should fail reported errors, but didn't return 1.
+
+My first reaction was to revert back to `./script.sh`, but the POSIX bug I caught is a strong strain, and when I went back to it, I figured that the callers were missing some flags.
+Specifically, `sh -eu script.sh`.
+
+Then it clicked: when running with `sh script.sh`, the shebang line with the sh options is ignored, as it is a comment!
+
+Which means that the shebang most friendly with POSIX is:
+
+```shell
+#!/bin/sh
+set -eu
+```
+
+1. when running via `./script.sh`, if the system has an executable at `/bin/sh`, it will be used to run the script;
+1. when running via `sh script.sh`, the sh options aren't ignored as previously.
+
+TIL.
+
+[posix-awk-0]: {% link _tils/2020-12-15-awk-snippet-shellcheck-all-scripts-in-a-repository.md %}
+[posix-awk-1]: {% link _tils/2021-01-12-awk-snippet-send-email-to-multiple-recipients-with-curl.md %}
diff --git a/locale/eo/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po b/locale/eo/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po
index fe7205f..57ea9cb 100644
--- a/locale/eo/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po
+++ b/locale/eo/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po
@@ -132,9 +132,9 @@ msgstr ""
msgid ""
"The point is: if the software isn't free/libre, \"The Long Now\" isn't "
"achievable without a lot of wishful thinking. Maybe the authors were trying "
-"to be more friendly towards business who don't like libre software, but in doing so "
-"they've proposed a contradiction by reconciling \"The Long Now\" with "
-"proprietary software."
+"to be more friendly towards business who don't like libre software, but in "
+"doing so they've proposed a contradiction by reconciling \"The Long Now\" "
+"with proprietary software."
msgstr ""
msgid ""
diff --git a/locale/eo/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po b/locale/eo/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po
new file mode 100644
index 0000000..e285d50
--- /dev/null
+++ b/locale/eo/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po
@@ -0,0 +1,97 @@
+#
+msgid ""
+msgstr ""
+
+msgid "title: POSIX sh and shebangs"
+msgstr ""
+
+msgid "date: 2021-01-17"
+msgstr ""
+
+msgid "layout: post"
+msgstr ""
+
+msgid "lang: en"
+msgstr ""
+
+msgid "ref: posix-sh-and-shebangs"
+msgstr ""
+
+msgid ""
+"As I [keep moving][posix-awk-0] [towards POSIX][posix-awk-1], I'm on the "
+"process of migrating all my Bash scripts to POSIX sh."
+msgstr ""
+
+msgid ""
+"As I dropped `[[`, arrays and other Bashisms, I was left staring at the "
+"first line of every script, wondering what to do: what is the POSIX sh "
+"equivalent of `#!/usr/bin/env bash`? I already knew that POSIX says nothing "
+"about shebangs, and that the portable way to call a POSIX sh script is `sh "
+"script.sh`, but I didn't know what to do with that first line."
+msgstr ""
+
+msgid "What I had previously was:"
+msgstr ""
+
+msgid ""
+"#!/usr/bin/env bash\n"
+"set -Eeuo pipefail\n"
+"cd \"$(dirname \"${BASH_SOURCE[0]}\")\"\n"
+msgstr ""
+
+msgid ""
+"Obviously, the `$BASH_SOURCE` would be gone, and I would have to adapt some "
+"of my scripts to not rely on the script location. The `-E` and `-o pipefail`"
+" options were also gone, and would be replaced by nothing."
+msgstr ""
+
+msgid "I converted all of them to:"
+msgstr ""
+
+msgid "#!/bin/sh -eu\n"
+msgstr ""
+
+msgid ""
+"I moved the `-eu` options to the shebang line itself, striving for "
+"conciseness. But as I changed callers from `./script.sh` to `sh script.sh`, "
+"things started to fail. Some tests that should fail reported errors, but "
+"didn't return 1."
+msgstr ""
+
+msgid ""
+"My first reaction was to revert back to `./script.sh`, but the POSIX bug I "
+"caught is a strong strain, and when I went back to it, I figured that the "
+"callers were missing some flags. Specifically, `sh -eu script.sh`."
+msgstr ""
+
+msgid ""
+"Then it clicked: when running with `sh script.sh`, the shebang line with the"
+" sh options is ignored, as it is a comment!"
+msgstr ""
+
+msgid "Which means that the shebang most friendly with POSIX is:"
+msgstr ""
+
+msgid ""
+"#!/bin/sh\n"
+"set -eu\n"
+msgstr ""
+
+msgid ""
+"when running via `./script.sh`, if the system has an executable at "
+"`/bin/sh`, it will be used to run the script;"
+msgstr ""
+
+msgid ""
+"when running via `sh script.sh`, the sh options aren't ignored as "
+"previously."
+msgstr ""
+
+msgid "TIL."
+msgstr ""
+
+msgid ""
+"[posix-awk-0]: {% link _tils/2020-12-15-awk-snippet-shellcheck-all-scripts-"
+"in-a-repository.md %} [posix-awk-1]: {% link _tils/2021-01-12-awk-snippet-"
+"send-email-to-multiple-recipients-with-curl.md %}"
+msgstr ""
diff --git a/locale/fr/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po b/locale/fr/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po
index fe7205f..57ea9cb 100644
--- a/locale/fr/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po
+++ b/locale/fr/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po
@@ -132,9 +132,9 @@ msgstr ""
msgid ""
"The point is: if the software isn't free/libre, \"The Long Now\" isn't "
"achievable without a lot of wishful thinking. Maybe the authors were trying "
-"to be more friendly towards business who don't like libre software, but in doing so "
-"they've proposed a contradiction by reconciling \"The Long Now\" with "
-"proprietary software."
+"to be more friendly towards business who don't like libre software, but in "
+"doing so they've proposed a contradiction by reconciling \"The Long Now\" "
+"with proprietary software."
msgstr ""
msgid ""
diff --git a/locale/fr/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po b/locale/fr/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po
new file mode 100644
index 0000000..e285d50
--- /dev/null
+++ b/locale/fr/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po
@@ -0,0 +1,97 @@
+#
+msgid ""
+msgstr ""
+
+msgid "title: POSIX sh and shebangs"
+msgstr ""
+
+msgid "date: 2021-01-17"
+msgstr ""
+
+msgid "layout: post"
+msgstr ""
+
+msgid "lang: en"
+msgstr ""
+
+msgid "ref: posix-sh-and-shebangs"
+msgstr ""
+
+msgid ""
+"As I [keep moving][posix-awk-0] [towards POSIX][posix-awk-1], I'm on the "
+"process of migrating all my Bash scripts to POSIX sh."
+msgstr ""
+
+msgid ""
+"As I dropped `[[`, arrays and other Bashisms, I was left staring at the "
+"first line of every script, wondering what to do: what is the POSIX sh "
+"equivalent of `#!/usr/bin/env bash`? I already knew that POSIX says nothing "
+"about shebangs, and that the portable way to call a POSIX sh script is `sh "
+"script.sh`, but I didn't know what to do with that first line."
+msgstr ""
+
+msgid "What I had previously was:"
+msgstr ""
+
+msgid ""
+"#!/usr/bin/env bash\n"
+"set -Eeuo pipefail\n"
+"cd \"$(dirname \"${BASH_SOURCE[0]}\")\"\n"
+msgstr ""
+
+msgid ""
+"Obviously, the `$BASH_SOURCE` would be gone, and I would have to adapt some "
+"of my scripts to not rely on the script location. The `-E` and `-o pipefail`"
+" options were also gone, and would be replaced by nothing."
+msgstr ""
+
+msgid "I converted all of them to:"
+msgstr ""
+
+msgid "#!/bin/sh -eu\n"
+msgstr ""
+
+msgid ""
+"I moved the `-eu` options to the shebang line itself, striving for "
+"conciseness. But as I changed callers from `./script.sh` to `sh script.sh`, "
+"things started to fail. Some tests that should fail reported errors, but "
+"didn't return 1."
+msgstr ""
+
+msgid ""
+"My first reaction was to revert back to `./script.sh`, but the POSIX bug I "
+"caught is a strong strain, and when I went back to it, I figured that the "
+"callers were missing some flags. Specifically, `sh -eu script.sh`."
+msgstr ""
+
+msgid ""
+"Then it clicked: when running with `sh script.sh`, the shebang line with the"
+" sh options is ignored, as it is a comment!"
+msgstr ""
+
+msgid "Which means that the shebang most friendly with POSIX is:"
+msgstr ""
+
+msgid ""
+"#!/bin/sh\n"
+"set -eu\n"
+msgstr ""
+
+msgid ""
+"when running via `./script.sh`, if the system has an executable at "
+"`/bin/sh`, it will be used to run the script;"
+msgstr ""
+
+msgid ""
+"when running via `sh script.sh`, the sh options aren't ignored as "
+"previously."
+msgstr ""
+
+msgid "TIL."
+msgstr ""
+
+msgid ""
+"[posix-awk-0]: {% link _tils/2020-12-15-awk-snippet-shellcheck-all-scripts-"
+"in-a-repository.md %} [posix-awk-1]: {% link _tils/2021-01-12-awk-snippet-"
+"send-email-to-multiple-recipients-with-curl.md %}"
+msgstr ""
diff --git a/locale/pt/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po b/locale/pt/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po
index fe7205f..57ea9cb 100644
--- a/locale/pt/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po
+++ b/locale/pt/LC_MESSAGES/_articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.po
@@ -132,9 +132,9 @@ msgstr ""
msgid ""
"The point is: if the software isn't free/libre, \"The Long Now\" isn't "
"achievable without a lot of wishful thinking. Maybe the authors were trying "
-"to be more friendly towards business who don't like libre software, but in doing so "
-"they've proposed a contradiction by reconciling \"The Long Now\" with "
-"proprietary software."
+"to be more friendly towards business who don't like libre software, but in "
+"doing so they've proposed a contradiction by reconciling \"The Long Now\" "
+"with proprietary software."
msgstr ""
msgid ""
diff --git a/locale/pt/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po b/locale/pt/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po
new file mode 100644
index 0000000..e285d50
--- /dev/null
+++ b/locale/pt/LC_MESSAGES/_tils/2021-01-17-posix-sh-and-shebangs.po
@@ -0,0 +1,97 @@
+#
+msgid ""
+msgstr ""
+
+msgid "title: POSIX sh and shebangs"
+msgstr ""
+
+msgid "date: 2021-01-17"
+msgstr ""
+
+msgid "layout: post"
+msgstr ""
+
+msgid "lang: en"
+msgstr ""
+
+msgid "ref: posix-sh-and-shebangs"
+msgstr ""
+
+msgid ""
+"As I [keep moving][posix-awk-0] [towards POSIX][posix-awk-1], I'm on the "
+"process of migrating all my Bash scripts to POSIX sh."
+msgstr ""
+
+msgid ""
+"As I dropped `[[`, arrays and other Bashisms, I was left staring at the "
+"first line of every script, wondering what to do: what is the POSIX sh "
+"equivalent of `#!/usr/bin/env bash`? I already knew that POSIX says nothing "
+"about shebangs, and that the portable way to call a POSIX sh script is `sh "
+"script.sh`, but I didn't know what to do with that first line."
+msgstr ""
+
+msgid "What I had previously was:"
+msgstr ""
+
+msgid ""
+"#!/usr/bin/env bash\n"
+"set -Eeuo pipefail\n"
+"cd \"$(dirname \"${BASH_SOURCE[0]}\")\"\n"
+msgstr ""
+
+msgid ""
+"Obviously, the `$BASH_SOURCE` would be gone, and I would have to adapt some "
+"of my scripts to not rely on the script location. The `-E` and `-o pipefail`"
+" options were also gone, and would be replaced by nothing."
+msgstr ""
+
+msgid "I converted all of them to:"
+msgstr ""
+
+msgid "#!/bin/sh -eu\n"
+msgstr ""
+
+msgid ""
+"I moved the `-eu` options to the shebang line itself, striving for "
+"conciseness. But as I changed callers from `./script.sh` to `sh script.sh`, "
+"things started to fail. Some tests that should fail reported errors, but "
+"didn't return 1."
+msgstr ""
+
+msgid ""
+"My first reaction was to revert back to `./script.sh`, but the POSIX bug I "
+"caught is a strong strain, and when I went back to it, I figured that the "
+"callers were missing some flags. Specifically, `sh -eu script.sh`."
+msgstr ""
+
+msgid ""
+"Then it clicked: when running with `sh script.sh`, the shebang line with the"
+" sh options is ignored, as it is a comment!"
+msgstr ""
+
+msgid "Which means that the shebang most friendly with POSIX is:"
+msgstr ""
+
+msgid ""
+"#!/bin/sh\n"
+"set -eu\n"
+msgstr ""
+
+msgid ""
+"when running via `./script.sh`, if the system has an executable at "
+"`/bin/sh`, it will be used to run the script;"
+msgstr ""
+
+msgid ""
+"when running via `sh script.sh`, the sh options aren't ignored as "
+"previously."
+msgstr ""
+
+msgid "TIL."
+msgstr ""
+
+msgid ""
+"[posix-awk-0]: {% link _tils/2020-12-15-awk-snippet-shellcheck-all-scripts-"
+"in-a-repository.md %} [posix-awk-1]: {% link _tils/2021-01-12-awk-snippet-"
+"send-email-to-multiple-recipients-with-curl.md %}"
+msgstr ""
diff --git a/scripts/spelling/en.txt b/scripts/spelling/en.txt
index fb5f7f3..aff474d 100644
--- a/scripts/spelling/en.txt
+++ b/scripts/spelling/en.txt
@@ -1,3 +1,4 @@
+Bashisms
Patches
Rollout
Slides