Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux OSX外壳脚本打开新终端窗口并运行程序_Linux_Macos_Bash_Shell - Fatal编程技术网

Linux OSX外壳脚本打开新终端窗口并运行程序

Linux OSX外壳脚本打开新终端窗口并运行程序,linux,macos,bash,shell,Linux,Macos,Bash,Shell,我正在尝试编写一个简短的shell脚本来打开一个新的终端窗口并启动一个程序。以下是我所拥有的: osascript <<END tell application "Terminal" make new window activate set contents of window to "./hello" & return end tell END osascript类似这样的内容: osascript<<EOF tell applica

我正在尝试编写一个简短的shell脚本来打开一个新的终端窗口并启动一个程序。以下是我所拥有的:

osascript <<END
tell application "Terminal"
    make new window
    activate
    set contents of window to "./hello" & return
end tell
END
osascript类似这样的内容:

 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

osascript命令在新的终端窗口中运行命令:

osascript -e 'tell app "Terminal" to do script "uptime"'