簡體   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