Skip to content

Commit 0e4d824

Browse files
committed
fix: bash version checks
1 parent 9deab22 commit 0e4d824

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

scripts/codespaces_create_and_start_containers.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ set -x # Print each command before executing it (useful for debugging)
1212

1313
cd $(dirname $0)
1414

15-
# Check Bash version (adjust version as needed)
16-
if [[ ! $(bash --version | head -n1 | awk '{print $4}' | cut -d'.' -f1-2) =~ ^5\. ]]; then
17-
echo "Error: Requires Bash version 5 or higher." >&2
15+
bash_version=$(/bin/bash --version | head -n 1 | awk '{print $4}' | cut -d. -f1,2)
16+
17+
if (( bash_version < 5 )); then
18+
echo 'Error: Requires Bash version 5 or higher.'
1819
exit 1
1920
fi
2021

scripts/codespaces_start_hackingbuddygpt_against_a_container.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ set -x # Print each command before executing it (useful for debugging)
1111

1212
cd $(dirname $0)
1313

14-
# Check Bash version (adjust version as needed)
15-
if [[ ! $(bash --version | head -n1 | awk '{print $4}' | cut -d'.' -f1-2) =~ ^5\. ]]; then
16-
echo "Error: Requires Bash version 5 or higher." >&2
14+
bash_version=$(/bin/bash --version | head -n 1 | awk '{print $4}' | cut -d. -f1,2)
15+
16+
if (( bash_version < 5 )); then
17+
echo 'Error: Requires Bash version 5 or higher.'
1718
exit 1
1819
fi
1920

scripts/mac_create_and_start_containers.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ set -x
88

99
cd $(dirname $0)
1010

11-
# Check Bash version (adjust version as needed)
12-
if [[ ! $(/opt/homebrew/bin/bash --version | head -n1 | awk '{print $4}' | cut -d'.' -f1-2) =~ ^5\. ]]; then
13-
echo "Error: Requires Bash version 5 or higher." >&2
11+
bash_version=$(/opt/homebrew/bin/bash --version | head -n 1 | awk '{print $4}' | cut -d. -f1,2)
12+
13+
if (( bash_version < 5 )); then
14+
echo 'Error: Requires Bash version 5 or higher.'
1415
exit 1
1516
fi
1617

scripts/mac_start_hackingbuddygpt_against_a_container.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ set -x # Print each command before executing it (useful for debugging)
1111

1212
cd $(dirname $0)
1313

14-
# Check Bash version (adjust version as needed)
15-
if [[ ! $(bash --version | head -n1 | awk '{print $4}' | cut -d'.' -f1-2) =~ ^3\. ]]; then
16-
echo "Error: Requires Bash version 3 or higher." >&2
14+
bash_version=$(/bin/bash --version | head -n 1 | awk '{print $4}' | cut -d. -f1,2)
15+
16+
if (( bash_version < 3 )); then
17+
echo 'Error: Requires Bash version 3 or higher.'
1718
exit 1
1819
fi
1920

0 commit comments

Comments
 (0)