Skip to content

Commit cc22348

Browse files
committed
exec on other bash version if available
1 parent 0b1de05 commit cc22348

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

all-projects.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ repoSeq=(
3737

3838
###########################################################################################################################
3939
if ((BASH_VERSINFO[0] < 4)); then
40-
echo "ERROR: bash 4.0 or newer is required"
41-
exit 1
40+
OTHER_BASH='/opt/local/bin/bash'
41+
if [[ -x "$OTHER_BASH" ]] && (( $("$OTHER_BASH" <<<'echo $BASH_VERSION'|sed 's/[.].*//') >= 4 )); then
42+
echo "INFO: restarting with "$OTHER_BASH" because this bash is too old but that one is new enough."
43+
exec "$OTHER_BASH" "$0" "$@"
44+
fi
45+
echo "ERROR: bash 4.0 or newer is required"
46+
exit 1
4247
fi
4348

4449
trap "onError" ERR

0 commit comments

Comments
 (0)