【发布时间】:2015-01-07 13:37:53
【问题描述】:
我正在运行 osx。我有一个运行完整堆栈的脚本,然后在最后运行 grunt。我希望能够在单独的终端选项卡中分离正在运行的 grunt,我正在使用 iterm。
我尝试过类似的东西
open -a Terminal "cd ~/dev/work/poc/user-interface/src/main/webapp; grunt"
有什么想法吗?
【问题讨论】:
我正在运行 osx。我有一个运行完整堆栈的脚本,然后在最后运行 grunt。我希望能够在单独的终端选项卡中分离正在运行的 grunt,我正在使用 iterm。
我尝试过类似的东西
open -a Terminal "cd ~/dev/work/poc/user-interface/src/main/webapp; grunt"
有什么想法吗?
【问题讨论】:
这应该为你做(显然改变目录和命令):
osascript -e '
tell app "iTerm"
activate
tell the first terminal
launch session "Default Session"
tell the last session
set name to "New Session"
write text "cd /usr/bin; ls"
end tell
end tell
end tell'
这是something I wrote 的略微修改版本,添加了对 RStudio 的 iTerm 支持。
【讨论】:
像这样:
#!/bin/bash
osascript -e '
tell application "Terminal"
do script "date"
activate
end tell'
将date 替换为您希望它执行的任何操作。
【讨论】:
iterm,但我会留下它,因为它可能对其他人有所帮助。
osascript 调用中,就像我为标准 Apple 术语所做的那样...code.google.com/p/iterm2/wiki/AppleScript