[英]How to open a new terminal window and do things there from a shell script?
[英]OSX shell script open new terminal window and run program
我正在尝试编写一个简短的shell脚本来打开一个新的终端窗口并启动一个程序。 这是我有的:
osascript <<END
tell application "Terminal"
make new window
activate
set contents of window to "./hello" & return
end tell
END
执行错误:终端出错:AppleEvent处理程序失败。 (-10000)
谁能告诉我怎么做? 在一个完美的世界中,我也喜欢这个脚本在Linux上运行,所以如果有一个可移植的方法,那就更好了。
谢谢!
do script
命令在新的终端窗口中运行命令:
osascript -e 'tell app "Terminal" to do script "uptime"'
这样的事情:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.