Skip to content

Instantly share code, notes, and snippets.

@SofianeHamlaoui
Created March 30, 2026 23:10
Show Gist options
  • Select an option

  • Save SofianeHamlaoui/284bf7c5d6be5db1a989ebc2768f463d to your computer and use it in GitHub Desktop.

Select an option

Save SofianeHamlaoui/284bf7c5d6be5db1a989ebc2768f463d to your computer and use it in GitHub Desktop.
Using Multiple Claude Accounts simultaneously
CLAUDE_ACCOUNTS=(
"$HOME/.claude-v1"
"$HOME/.claude-v2"
"$HOME/.claude-v3"
"$HOME/.claude-v4"
)
claude() {
local binary
binary=$(command -v claude 2>/dev/null)
for dir in "${CLAUDE_ACCOUNTS[@]}"; do
echo "→ Trying account: $dir"
CLAUDE_CONFIG_DIR="$dir" "$binary" "$@"
local exit_code=$?
if [[ $exit_code -eq 0 ]]; then
return 0
fi
echo "⚠ Account $dir exited with code $exit_code — switching to next account..."
done
echo "✗ All accounts exhausted."
return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment