bash - 在 gnome 终端的新选项卡中运行脚本
问题描述
到目前为止,我有这个有效的命令
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)
解决方案
The reason that:
gnome-terminal --tab -- '/bin/bash -c "ls";bash'
Fails is that it is looking for a program with that as its name. This is an instance of chain loading where the rest of the arguments are passed as is to exec. Those first argument is the name of the program. With this quoting it receives the entire command and options as a single program name.
Change the quoting to:
gnome-terminal --tab -- /bin/bash -c "ls;bash"
推荐阅读
- html - 视频自动播放在某些 Safari 浏览器上不起作用
- php - 如何根据键名条件从集合中获取价值?
- c++ - MDI选项卡名称变回.../任务栏预览未选择
- python - 保持 robotsframework 关键字库中的应用程序实例处于活动状态
- javascript - 抽象 React Router Dom 后路由参数不起作用
- mysql - 有没有一种简单的方法可以根据mysql中的优先级为每个类别的每一行分配最高值?
- omnet++ - 错误:在数据报中找不到 TLV 选项
- visual-studio-code - Visual Studio Code - Task.Todo 扩展
- python - 打开一个命令窗口并使用 Python 将内容传递给它
- flutter - Android Studio第三个依赖包导入intellisense没用