输入AppleScript。
它没有达到刚好你所描述的,但我认为它足够接近。你是否使用这个取决于你。
您可以使用此命令
osascript -e 'tell app "system events" to tell process "Terminal" to tell menu bar 1 to tell menu bar item "Shell" to tell menu "Shell" to tell menu item "New Window" to tell menu "New Window" to click menu item "Basic"'
,或者在展开形式
tell app "system events"
tell process "Terminal"
tell menu bar 1
tell menu bar item "Shell"
tell menu "Shell"
tell menu item "New Window"
tell menu "New Window"
click menu item "Basic" #or any other profile
end tell
end tell
end tell
end tell
end tell
end tell
end tell
要与所需的配置文件中创建一个新的终端窗口。 (在这个例子中,我使用的基本)
如果你得到错误
System Events got an error: osascript is not allowed assistive access
然后看看如何解决this SO answer by @NGAFD。
进入系统偏好设置>安全和隐私>隐私>辅助功能,并确保终端在列表中并被检查。