From 00d3c09ddb010d1f6cfddfdfaa9dab63f7d0c36d Mon Sep 17 00:00:00 2001 From: Jon Higgs Date: Mon, 26 Feb 2018 10:11:44 +1100 Subject: [PATCH 1/2] Raise error unless interpreter supports globstar --- nextnumber | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nextnumber b/nextnumber index ab411ac..6caa777 100755 --- a/nextnumber +++ b/nextnumber @@ -1,7 +1,10 @@ #!/bin/bash # TODO: Find a less trashy way to get the next available error code - -shopt -s globstar +if ! shopt -s globstar +then + echo "Error: This script depends on Bash 4." >&2 + exit 1 +fi for i in 1 2 do From 7fb27310e15c21b9bc0b1abaebbf45f351e74acd Mon Sep 17 00:00:00 2001 From: Jon Higgs Date: Mon, 26 Feb 2018 10:12:27 +1100 Subject: [PATCH 2/2] Rely upon /usr/bin/env to find bash This allows you to use the homebrew install Bash 4 on MacOS systems. It should compatible with most if not all modern Linux distros. --- nextnumber | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextnumber b/nextnumber index 6caa777..6b91a92 100755 --- a/nextnumber +++ b/nextnumber @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # TODO: Find a less trashy way to get the next available error code if ! shopt -s globstar then