From f333fc5db7cc31b82cdcc90444bbebb9b38f84e8 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 23 Sep 2025 14:29:44 +0200 Subject: [PATCH] Improve shell detection in shell_check function 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. --- misc/core.func | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/misc/core.func b/misc/core.func index fde0281f..c74d244f 100644 --- a/misc/core.func +++ b/misc/core.func @@ -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 }