[英]How can I open multiple tabs automatically on terminal in mac os Lion by executing some commands on each tab?
我需要自動打開帶有多個選項卡的終端,並需要在其上執行多個命令。
我知道如何在ubuntu中做到這一點。 但它不適用於mac os。 任何想法?
gnome-terminal --tab -e "tail -f somefile" --tab -e "some_other_command"
我可以給你一個線索。
使用osascript
,你可以做到。
更新:
您需要了解的一件事是, gnome-terminal
適用於Linux。 Gnome
是一個非常流行的Linux環境桌面環境。
使用此oneliner打開一個帶有$ PWD的新選項卡作為工作目錄:
osascript -e "tell application \"Terminal\"" -e "tell application \"System Events\" to keystroke \"t\" using {command down}" -e "do script \"cd $PWD; clear\" in front window" -e "end tell" > /dev/null
在一個班輪后面只打開一個帶有$PWD
作為工作目錄的新標簽,並執行echo Hi
osascript -e "tell application \"Terminal\"" -e "tell application \"System Events\" to keystroke \"t\" using {command down}" -e "do script \"cd $PWD; echo HI\" in front window" -e "end tell" > /dev/null
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.