此脚本执行您要求的操作,您可以使用osascript它从cmd行运行它.
tell application "Terminal"
set c to 0
repeat with i from 1 to (count of windows)
set c to c + (count of tabs in window i)
end repeat
c
end tell
Run Code Online (Sandbox Code Playgroud)
由Bavarious编辑:为了在shell脚本中使用Adam的AppleScript,您可以执行以下操作:
#!/bin/bash
read -d '' OSASCRIPT << EOF
tell application "Terminal"
set c to 0
repeat with i from 1 to (count of windows)
set c to c + (count of tabs in window i)
end repeat
c
end tell
EOF
nwindows=$(osascript -e "${OSASCRIPT}")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
977 次 |
| 最近记录: |