2017-09-16 129 views
0

以下bash腳本是假設打開2個新的端子接線片,然後執行相應的命令:擊 - 打開然後一個新的終端標籤執行命令

mate-terminal --tab -e "cd ~/ece344/root; sys161 -w kernel" --tab -e "cd ~/ece344/root; cs161-gdb kernel" 

該腳本並打開2個新的標籤頁然而這兩個選項卡顯示以下錯誤:

There was an error creating the child process for this terminal 
Failed to execute child process "cd" (No such file or directory) 

Ps。答案應該與mate-terminal一起使用。

回答

1

我沒有安裝的隊友,但我會嘗試:

mate-terminal --tab -e "/bin/bash -c 'cd ~/ece344/root; sys161 -w kernel'" --tab -e "/bin/bash -c 'cd ~/ece344/root; cs161-gdb kernel'" 

的想法是,「-E」將要執行的是很可能的窗口,而不是默認的shell中運行一個命令,所以從錯誤我明白,「CD」是不是一個真正的程序在預期的位置(因爲'CD'是在路徑中不應該是一個問題 所以我的例子會提供一個完整的路徑到一個shell「/ bin/bash「然後執行你想要的命令

+0

是產生相同的錯誤,除了現在它的'」無法執行子進程「bin/bash」(沒有這樣的文件或目錄)「' –

+0

這個錯誤信息表明你寫了'-e「bin/bash ...」',而不是'-e「/ bin/bash ...」'。 – chepner

+0

是的,這是問題,謝謝。 –

相關問題