Skip to content

Instantly share code, notes, and snippets.

@htlin222
Created July 2, 2025 04:35
Show Gist options
  • Save htlin222/4266be3774ae0d31d7e19752bac1a877 to your computer and use it in GitHub Desktop.
Save htlin222/4266be3774ae0d31d7e19752bac1a877 to your computer and use it in GitHub Desktop.
如何把 claude code 用爆
START=1
END=100
for i in $(seq -w $START $END); do
echo "Now processing note ${i}..."
claude -p --verbose "Now Process ${i}.md, YOUR_PROMPT_HERE"
osascript -e "display notification \"Finished ${i}\" with title \"Claude Processing\""
done
osascript -e "display notification \"All notes from ${START} to ${END} processed.\" with title \"Done\""
echo "All notes from ${START} to ${END} have been processed."
@htlin222
Copy link
Author

htlin222 commented Jul 2, 2025

這是一個教學範例,示範如何用 Bash 搭配 Claude Code CLI 來批次處理 1.md 到 100.md 的 Markdown 檔案,完全以 Max 訂閱方案直接一路硬跑下去。當中 -p 是一個很實用的 flag,用來告訴 Claude Code 你要直接從命令列傳入 prompt(prompt mode),它會馬上把 "Now Process ${i}.md, YOUR_PROMPT_HERE" 當作輸入內容來處理,不進入互動式對話,只跑一次就結束,適合大量、自動化的批次作業。整段腳本搭配 osascript 發出 macOS 通知,讓你清楚看到每個檔案處理完成的即時進度。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment