Improve shell detection in shell_check function
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled

Enhanced the shell_check function to handle both 'bash' and '-bash' as valid shells, added a debug message to display the detected shell, and changed the exit code to 1 for clearer error signaling.
This commit is contained in:
CanbiZ 2025-09-23 14:29:44 +02:00
parent 1d5601af6f
commit f333fc5db7

View File

@ -152,14 +152,19 @@ silent() {
fi
}
# Check if the shell is using bash
# Check if the shell is using bash
shell_check() {
if [[ "$(ps -p $$ -o comm=)" != "bash" ]]; then
local CURRENT_SHELL
CURRENT_SHELL="$(ps -p $$ -o comm=)"
echo "DEBUG: Detected shell is: '$CURRENT_SHELL'"
if [[ "$CURRENT_SHELL" != "bash" && "$CURRENT_SHELL" != "-bash" ]]; then
clear
msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell."
echo -e "\nExiting..."
sleep 2
exit
exit 1
fi
}