[英]iTerm2 and tmux: open new tab in working directory of current tab
[英]Open new tab in ITerm2 and run commands there with zsh script
我想制作一個Shell腳本來啟動我的項目環境。 我正在使用安裝了zsh和oh-my-zsh的ITerm2。
我想要:
我所得到的是這樣的:
#!/bin/zsh
cd ~/Projects/python/project_name
source ~/virtualenvs/project_name/bin/activate
python ./backend/manage.py runserver
tab
cd front
gulp watch
正如您所料,這是行不通的。 您能指出我應該去的方向,還是僅使用shell腳本就可以做到?
完全有可能。
我使用一個名為ttab的NPM包做了幾乎相同的事情(盡管它是一個Rails項目)。
# First switch to directory
cd front
# Open new tab in that directory and execute
ttab -G eval "gulp watch"
注意:如果需要,您可以執行幾個命令,例如gulp watch; rails s
gulp watch; rails s
。
# Define the function before it is called
gotofolder()
{
cd ~/mydirectory
}
# start the other tabs (...)
# change the original tab directory
gotofolder
# Run Rails or whatever
./bin/rails s
如果您想了解我的操作方式,請在我的MDFR存儲庫中檢出confereai.sh
腳本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.