我正在尝试写一个简短的shell脚本来打开一个新的terminal窗口并启动一个程序。 这是我有什么:
osascript <<END tell application "Terminal" make new window activate set contents of window to "./hello" & return end tell END
执行错误:terminal有一个错误:AppleEvent处理程序失败。 (-10000)
谁能告诉我如何做到这一点? 在一个完美的世界里,我也喜欢这个脚本在Linux上运行,所以如果有一个方法是可移植的,那将是更可取的。
谢谢!
像这样的东西:
osascript<<EOF tell application "System Events" tell process "Terminal" to keystroke "t" using command down end tell application "Terminal" activate do script with command "./hello" in window 1 end tell EOF
do script
命令在新的“终端”窗口中运行命令:
osascript -e 'tell app "Terminal" to do script "uptime"'