Last active 7 months ago

自動檢測 macOS 並設置 iTerm2 偏好設定資料夾為自訂路徑。

Revision 0048a0bf2020ebf1506d167c8e6a43ce0ebdd662

macos_iterm2_custom_prefs.sh Raw
1#!/bin/sh
2
3# 取得作業系統類型(例如 Darwin 表示 macOS)
4system_type=$(uname -s)
5
6# 如果是 macOS 系統,才執行以下區塊
7if [ "$system_type" = "Darwin" ]; then
8
9 # 這裡可以考慮加入使用 Homebrew 安裝 iTerm2 的指令(例如 brew install --cask iterm2)
10 # 不過目前尚未實作
11
12 # 檢查使用者家目錄下是否有 .iterm2 設定資料夾
13 if [ -d "$HOME/.iterm2" ]; then
14 echo "設定 iTerm2 偏好設定資料夾路徑"
15 # 將 iTerm2 的偏好設定指向自訂的資料夾
16 defaults write com.googlecode.iterm2 PrefsCustomFolder "$HOME/.iterm2"
17 fi
18
19fi
20