在 osx 上,如何从一个脚本打开新的 iterm 终端选项卡,然后在该终端窗口中运行命令 [英] On osx, how to open new iterm terminal tab from one script then run command in that temrinal window

查看:22
本文介绍了在 osx 上,如何从一个脚本打开新的 iterm 终端选项卡,然后在该终端窗口中运行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 osx.我有一个运行完整堆栈的脚本,然后在最后运行 grunt.我希望能够在单独的终端选项卡中单独运行 grunt,我正在使用 iterm.

I am running osx. I have a script which runs the full stack then runs grunt at the end. I want to be able to separate running grunt in a separate terminal tab, i am using iterm.

我尝试过类似的东西

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

有什么想法吗?

推荐答案

这应该适合你(显然改变 dir & 命令):

This should do it for you (obviously change dir & command):

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'

这是我写的东西 为 RStudio 添加 iTerm 支持.

It's a slightly modified version of something I wrote to add iTerm support for RStudio.

这篇关于在 osx 上,如何从一个脚本打开新的 iterm 终端选项卡,然后在该终端窗口中运行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆