diff --git a/GeminiCLI/setup-gemini.sh b/GeminiCLI/setup-gemini.sh index fb449be..a26d39d 100755 --- a/GeminiCLI/setup-gemini.sh +++ b/GeminiCLI/setup-gemini.sh @@ -125,7 +125,7 @@ create_settings_file() { local api_key="$2" # Write to .env file - cat < "$GEMINI_ENV_FILE" + cat <"$GEMINI_ENV_FILE" GOOGLE_GEMINI_BASE_URL="$base_url" GEMINI_API_KEY="$api_key" GEMINI_MODEL="gemini-3-pro-preview" @@ -134,7 +134,7 @@ EOF # Write to settings.json local settings_json_path="$GEMINI_CONFIG_DIR/settings.json" - cat < "$settings_json_path" + cat <"$settings_json_path" { "general": { "previewFeatures": true @@ -179,20 +179,20 @@ main() { while [[ $# -gt 0 ]]; do case $1 in - -k|--key) - api_key="$2" - shift 2 - ;; - -t|--test) - test_only=true - shift - ;; - -s|--show) - show_settings=true - shift - ;; - -h|--help) - cat <> "$rc_file" + echo "" >>"$rc_file" fi # 转义特殊字符(使用单引号包裹更安全) @@ -73,12 +73,12 @@ write_env_to_shell() { local tmp_file tmp_file=$(mktemp) if [ -s "$rc_file" ]; then - grep -v "^export $var_name=" "$rc_file" | grep -v "^set -Ux $var_name " > "$tmp_file" 2>/dev/null || true + grep -v "^export $var_name=" "$rc_file" | grep -v "^set -Ux $var_name " >"$tmp_file" 2>/dev/null || true fi - echo "$export_line" >> "$tmp_file" + echo "$export_line" >>"$tmp_file" # 保留原文件权限 - cat "$tmp_file" > "$rc_file" + cat "$tmp_file" >"$rc_file" rm -f "$tmp_file" # 立即生效 diff --git a/setup-claude-code.sh b/setup-claude-code.sh index 628b86b..d058beb 100644 --- a/setup-claude-code.sh +++ b/setup-claude-code.sh @@ -163,7 +163,7 @@ create_settings() { # Write config.json for VSCode Claude extension local config_json_path="$CLAUDE_CONFIG_DIR/config.json" - cat < "$config_json_path" + cat <"$config_json_path" { "primaryApiKey": "xcodecli" }