From d7c65f5d552ed8a16571d96b778732588753ece3 Mon Sep 17 00:00:00 2001 From: Wiwi Kuan Date: Sat, 11 May 2024 09:29:16 +0800 Subject: [PATCH] Update occ.sh --- occ.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/occ.sh b/occ.sh index 4c464e3..e0f36ca 100644 --- a/occ.sh +++ b/occ.sh @@ -23,5 +23,14 @@ opencc -i "$input" -o "$output" -c s2tw.json # 輸出結果 cat "$output" +# 將結果複製到剪貼簿 +if command -v pbcopy >/dev/null 2>&1; then + # macOS + cat "$output" | pbcopy +elif command -v xclip >/dev/null 2>&1; then + # Linux + cat "$output" | xclip -selection clipboard +fi + # 清理臨時檔案 rm "$input" "$output"