ScriptsApr 17, 2026·1 min read

claude-switch — Claude Code

一个 bash 脚本,用于快速切换 Claude Code 登录账号(Pro/Max 多账号、团队/个人账号切换)。显示当前邮箱 → 登出 → 浏览器登录 → 确认切换结果。安装到 $PATH 后直接运行 `claude-switch`,或在 Claude Code 会话里 `! claude-switch`。

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 19/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
Script
Install
Stage only
Trust
Verified publisher
Entrypoint
claude-switch
Safe staging command
npx -y tokrepo@latest install 6a7bdab0-c7ac-4208-94b4-fd3d9fe61222 --target codex

Stages files first; activation requires review of the staged README and plan.

#!/bin/bash

Claude Code 账号快速切换

用法: claude-switch 或在 Claude Code 里执行 ! claude-switch

set -e

获取当前账号

CURRENT=$(claude auth status 2>/dev/null | grep '"email"' | awk -F'"' '{print $4}') echo "📌 当前账号: ${CURRENT:-未登录}"

登出

echo "🔄 正在登出..." claude auth logout 2>/dev/null || true

登录新账号

echo "🌐 请在浏览器中授权新账号..." claude auth login

确认新账号

NEW=$(claude auth status 2>/dev/null | grep '"email"' | awk -F'"' '{print $4}') if [ -z "$NEW" ]; then echo "❌ 登录失败" exit 1 fi

echo "✅ 已切换: ${CURRENT:-无} → $NEW"

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets