Improve shell detection in shell_check function
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled
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:
parent
1d5601af6f
commit
f333fc5db7
@ -152,14 +152,19 @@ silent() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if the shell is using bash
|
||||||
# Check if the shell is using bash
|
# Check if the shell is using bash
|
||||||
shell_check() {
|
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
|
clear
|
||||||
msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell."
|
msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell."
|
||||||
echo -e "\nExiting..."
|
echo -e "\nExiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user