From 53e3208ba0b3d1a28fd8c2c27b7c9b1bcb2fbb2b Mon Sep 17 00:00:00 2001 From: Joseph Dalrymple Date: Tue, 4 Apr 2023 02:00:31 -0500 Subject: [PATCH] Improved portability by using /usr/bin/env pragma --- README.md | 4 ++-- demo/associative-arrays | 2 +- demo/embedded-template | 2 +- demo/function-args | 2 +- demo/function-for-advanced-looping | 2 +- demo/function-for-building-json | 2 +- demo/important-file | 2 +- demo/sourcing | 2 +- demo/using-arrays | 2 +- demo/using-strings | 2 +- make-api-doc | 2 +- run-spec.js | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9af081d..b193a09 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ How to Use If you only plan using strings and numbers, nothing could be simpler. In your shell script you can choose to export the variables. The below script is [`demo/using-strings`](demo/using-strings). - #!/bin/bash + #!/usr/bin/env bash cd "$(dirname "$0")" # Go to the script's directory export TEST="This is a test" echo "Your message: {{TEST}}" | ../mo @@ -100,7 +100,7 @@ The result? "Your message: This is a test". Using arrays adds a slight level of complexity. *You must source `mo`.* Look at [`demo/using-arrays`](demo/using-arrays). - #!/bin/bash + #!/usr/bin/env bash cd "$(dirname "$0")" # Go to the script's directory export ARRAY=( one two "three three three" four five ) . ../mo # This loads the "mo" function diff --git a/demo/associative-arrays b/demo/associative-arrays index 81e7f0b..bc66117 100755 --- a/demo/associative-arrays +++ b/demo/associative-arrays @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "$(dirname "$0")" # Go to the script's directory diff --git a/demo/embedded-template b/demo/embedded-template index 5896652..cd1488d 100755 --- a/demo/embedded-template +++ b/demo/embedded-template @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This embeds a template in the script without using strange `cat` syntax. diff --git a/demo/function-args b/demo/function-args index 83fa354..c461d61 100755 --- a/demo/function-args +++ b/demo/function-args @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This sources a simple script with the env. variables needed for the template. diff --git a/demo/function-for-advanced-looping b/demo/function-for-advanced-looping index b734246..4bd9e1e 100755 --- a/demo/function-for-advanced-looping +++ b/demo/function-for-advanced-looping @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "$(dirname "$0")" # Go to the script's directory diff --git a/demo/function-for-building-json b/demo/function-for-building-json index 3ab7b73..483ec0b 100755 --- a/demo/function-for-building-json +++ b/demo/function-for-building-json @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "$(dirname "$0")" # Go to the script's directory diff --git a/demo/important-file b/demo/important-file index cd39322..0e4e9b5 100755 --- a/demo/important-file +++ b/demo/important-file @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "$(dirname "$0")"/.. diff --git a/demo/sourcing b/demo/sourcing index f9dd47f..c5fe201 100755 --- a/demo/sourcing +++ b/demo/sourcing @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This sources a simple script with the env. variables needed for the template. diff --git a/demo/using-arrays b/demo/using-arrays index ff27f28..1020b0d 100755 --- a/demo/using-arrays +++ b/demo/using-arrays @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "$(dirname "$0")" # Go to the script's directory export ARRAY=( one two "three three three" four five ) . ../mo diff --git a/demo/using-strings b/demo/using-strings index bec05d7..232851c 100755 --- a/demo/using-strings +++ b/demo/using-strings @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This example does not source `mo` and is intentionally restricted to # variables that are not arrays. diff --git a/make-api-doc b/make-api-doc index 6cb4fe1..f3ebd16 100755 --- a/make-api-doc +++ b/make-api-doc @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This requires tomdoc.sh to be in your PATH. # https://github.com/tests-always-included/tomdoc.sh diff --git a/run-spec.js b/run-spec.js index 891432a..69b290d 100644 --- a/run-spec.js +++ b/run-spec.js @@ -64,7 +64,7 @@ function runTest(test, done) { var output, partials, script; script = [ - '#!/bin/bash' + '#!/usr/bin/env bash' ]; partials = test.partials || {};