运行 gnome 终端新标签页中的脚本

Run script in new tab in gnome terminal

到目前为止,我的命令有效

gnome-terminal --tab -e '/bin/bash -c "ls";bash'

但是有一个警告

# Option “-e” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.

当我将其更改为

gnome-terminal --tab -- '/bin/bash -c "ls";bash'

新标签失败

There was an error creating the child process for this terminal
Failed to execute child process “/bin/bash -c "ls";bash” (No such file or directory)

原因:

gnome-terminal --tab -- '/bin/bash -c "ls";bash'

失败是它正在寻找一个以此为名的程序。这是链式加载的一个实例,其中其余参数按原样传递给 exec。第一个参数是程序的名称。通过这个引用,它接收整个命令和选项作为一个程序名。

将引用更改为:

gnome-terminal --tab -- /bin/bash -c "ls;bash"