Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash-打开一个新的终端选项卡,然后执行命令_Bash_Terminal - Fatal编程技术网

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

Bash-打开一个新的终端选项卡,然后执行命令,bash,terminal,Bash,Terminal,假设以下bash脚本打开2个新的终端选项卡,然后执行相应的命令: mate-terminal --tab -e "cd ~/ece344/root; sys161 -w kernel" --tab -e "cd ~/ece344/root; cs161-gdb kernel" 脚本确实打开了两个新选项卡,但两个选项卡都显示以下错误: There was an error creating the child process for this terminal Failed to execute

假设以下bash脚本打开2个新的终端选项卡,然后执行相应的命令:

mate-terminal --tab -e "cd ~/ece344/root; sys161 -w kernel" --tab -e "cd ~/ece344/root; cs161-gdb kernel"
脚本确实打开了两个新选项卡,但两个选项卡都显示以下错误:

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

注:答案应适用于
mate终端

我没有安装mate,但我会尝试:

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”的完整路径,该shell随后将执行您想要的命令。

Is产生相同的错误,但现在它的
“未能执行子进程“bin/bash”(没有这样的文件或目录)”
错误消息表明您编写了
-e“bin/bash…”
,而不是
-e”/bin/bash…”