From 5f0959b1f88bc25d4a2981ffc9fa4b6ed6644f3c Mon Sep 17 00:00:00 2001 From: Wangpeng Date: Thu, 3 Apr 2025 15:48:55 +0800 Subject: [PATCH] Fix: Replace `[]` with `[[ ]]` for cross - shell compatibility in Bash and Zsh resolve this issue: https://github.com/moovweb/gvm/issues/498 --- binscripts/gvm-installer | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/binscripts/gvm-installer b/binscripts/gvm-installer index 829a69a..9d73072 100755 --- a/binscripts/gvm-installer +++ b/binscripts/gvm-installer @@ -111,12 +111,12 @@ if [ -z "$GVM_NO_UPDATE_PROFILE" ] ; then if [ -f "$HOME/.zshrc" ]; then update_profile "$HOME/.zshrc" fi - if [ "$(uname)" == "Linux" ]; then + if [[ "$(uname)" == "Linux" ]]; then update_profile "$HOME/.bashrc" || update_profile "$HOME/.bash_profile" - elif [ "$(uname)" == "Darwin" ]; then + elif [[ "$(uname)" == "Darwin" ]]; then LOGIN_SHELL=$(finger $(id -u -n) | grep Shell | cut -d : -f 3) echo "macOS detected. User shell is:" $LOGIN_SHELL - if [ $LOGIN_SHELL == "/bin/zsh" ]; then # macOS moved to ZSH after macOS Catalina + if [[ $LOGIN_SHELL == "/bin/zsh" ]]; then # macOS moved to ZSH after macOS Catalina update_profile "$HOME/.zshrc" else update_profile "$HOME/.profile" || update_profile "$HOME/.bash_profile"