我创建了一个 .sh 脚本,其中包含打开终端的选项,并且同一终端运行 2 个命令。 我知道打开一个新窗口或选项卡并运行命令,但是当我输入 && 时,我使用此命令收到如下错误:
命令:
gnome-terminal --tab -- "ls && clear"
错误:
There was an error creating the child process for this terminal
Failed to execute child process “ls && clear” (No such file or directory)
我的操作系统是Linux(Ubuntu)
最佳答案
gnome-terminal
需要命令名称。它查找字面上称为 ls && clear 的命令,但找不到它。您需要在 shell 中运行它:
gnome-terminal --tab -- bash -c "ls && clear"
关于bash - 如何打开一个新终端并运行两个linux命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56448239/