Last active 10 months ago

這段腳本切換到使用者的 iCloud Drive 目錄 (Mobile Documents/com~apple~CloudDocs),確認目錄存在後切換到該目錄,並輸出當前工作目錄位置。

timmy revised this gist 10 months ago. Go to revision

No changes

timmy revised this gist 11 months ago. Go to revision

No changes

timmy revised this gist 11 months ago. Go to revision

1 file changed, 13 insertions

cd_to_icloud.sh(file created)

@@ -0,0 +1,13 @@
1 + #!/bin/bash
2 +
3 + BASE_DIR="$HOME/Library/Mobile Documents/com~apple~CloudDocs"
4 +
5 + # 確認目錄是否存在
6 + if [ -d "$BASE_DIR" ]; then
7 + echo "切換到目標目錄: $BASE_DIR"
8 + cd "$BASE_DIR" || { echo "無法進入目標目錄,退出腳本。"; exit 1; }
9 + fi
10 +
11 + # 執行目錄內的操作
12 + echo "目前位置:$(pwd)"
13 +
Newer Older