49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# claude-anthropic.sh
|
|
|
|
# Hide configs
|
|
if [[ -f ~/.claude.json ]]; then
|
|
mv ~/.claude.json ~/.claude.json.temp
|
|
fi
|
|
|
|
if [[ -f ~/.claude/settings.json ]]; then
|
|
mv ~/.claude/settings.json ~/.claude/settings.json.temp
|
|
fi
|
|
|
|
# Start a background process to restore configs after delay
|
|
(
|
|
sleep 60 # Wait 60 seconds
|
|
|
|
# Restore configs
|
|
if [[ -f ~/.claude.json.temp ]]; then
|
|
mv ~/.claude.json.temp ~/.claude.json
|
|
fi
|
|
|
|
if [[ -f ~/.claude/settings.json.temp ]]; then
|
|
mv ~/.claude/settings.json.temp ~/.claude/settings.json
|
|
fi
|
|
|
|
echo "✅ GLM configs auto-restored after 60s"
|
|
) &
|
|
|
|
RESTORE_PID=$!
|
|
|
|
echo "🏢 Starting Anthropic Claude (GLM configs will auto-restore in 60s)..."
|
|
|
|
# Run Claude normally in foreground
|
|
claude "$@"
|
|
|
|
# If Claude exits before the timer, kill the restore process and restore immediately
|
|
kill $RESTORE_PID 2>/dev/null
|
|
|
|
# Make sure configs are restored even if timer didn't run
|
|
if [[ -f ~/.claude.json.temp ]]; then
|
|
mv ~/.claude.json.temp ~/.claude.json
|
|
fi
|
|
|
|
if [[ -f ~/.claude/settings.json.temp ]]; then
|
|
mv ~/.claude/settings.json.temp ~/.claude/settings.json
|
|
fi
|
|
|
|
echo "✅ GLM configs restored"
|