繁体   English   中英

在osx上,如何从一个脚本打开新的iterm终端选项卡,然后在该临时窗口中运行命令

[英]On osx, how to open new iterm terminal tab from one script then run command in that temrinal window

我正在运行osx。 我有一个脚本,它将运行完整的堆栈,然后在末尾运行grunt。 我希望能够在单独的终端选项卡中分离运行的咕separate声,我正在使用iterm。

我已经尝试过类似的东西

open -a Terminal "cd ~/dev/work/poc/user-interface/src/main/webapp; grunt"

有任何想法吗?

这应该为您做到(显然更改dir&命令):

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'

是我为添加iTerm对RStudio的支持而编写的内容的略微修改版本。

像这样:

#!/bin/bash
osascript -e '
   tell application "Terminal"
   do script "date"
   activate
   end tell'

用您想要的date替换date

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM