Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9951e7

Browse files
authored
Send the script to bash instead of exitting, if bash does not exist -> exit
Added a check to ensure the script runs in bash and attempts to invoke bash if not.
1 parent 5b4668b commit c9951e7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

AffinityScripts/AffinityLinuxInstaller.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ fi
1414

1515
# Ensure script is being run with bash
1616
if [ -z "$BASH_VERSION" ]; then
17-
echo "This script must be run with bash"
18-
exit 1
17+
echo "Running script in bash"
18+
# Check bash existence
19+
if command -v bash >/dev/null 2>&1; then
20+
exec bash "$0" "$@"
21+
else
22+
echo "This script must be run with bash" >&2
23+
exit 1
24+
fi
1925
fi
2026

2127
# ==========================================

0 commit comments

Comments
 (0)