Bash - 打开一个新的终端选项卡然后执行命令

时间:2017-09-16 19:50:07

标签: bash terminal

以下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)

聚苯乙烯。答案应与mate-terminal一起使用。

1 个答案:

答案 0 :(得分:2)

我没有安装配件,但我会尝试:

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'在PATH中应该不是问题。 所以我的例子将提供一个shell“/ bin / bash”的完整路径,然后执行你想要的命令。

相关问题