diff --git a/scripts/zsh_cleanup.sh b/scripts/zsh_cleanup.sh index c12deae..79c84b1 100755 --- a/scripts/zsh_cleanup.sh +++ b/scripts/zsh_cleanup.sh @@ -9,11 +9,18 @@ openAIConfigPath="$CODEX_CLI_PATH/src/openaiapirc" zshrcPath="$HOME/.zshrc" # 1. Remove settings in .zshrc -sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath +# Check if the current system is Darwin (i.e. MacOS) +if [[ "$OSTYPE" == "Darwin" ]]; then + # Command to execute on MacOS + sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath +else + # Command to execute on Linux + sed -i '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath +fi echo "Removed settings in $zshrcPath if present" # 2. Remove opanaiapirc in /.config rm -f $openAIConfigPath echo "Removed $openAIConfigPath" -echo "Codex CLI clean up completed. Please open a new zsh to continue." \ No newline at end of file +echo "Codex CLI clean up completed. Please open a new zsh to continue." diff --git a/scripts/zsh_setup.sh b/scripts/zsh_setup.sh index 312fc0f..30465ce 100755 --- a/scripts/zsh_setup.sh +++ b/scripts/zsh_setup.sh @@ -43,7 +43,15 @@ validateSettings() configureZsh() { # Remove previous settings - sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath + + # Check if the current system is Darwin (i.e. MacOS) + if [[ "$OSTYPE" == "Darwin" ]]; then + # Command to execute on MacOS + sed -i '' '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath + else + # Command to execute on Linux + sed -i '/### Codex CLI setup - start/,/### Codex CLI setup - end/d' $zshrcPath + fi echo "Removed previous settings in $zshrcPath if present" # Update the latest settings @@ -116,4 +124,4 @@ echo -e "*** Setup complete! ***\n"; echo "***********************************************" echo "Open a new zsh terminal, type '#' followed by" echo "your natural language command and hit Ctrl + G!" -echo "***********************************************" \ No newline at end of file +echo "***********************************************"