如何打开在Linux中的程序的多个实例 [英] How to open multiple instances of a program in Linux

查看:268
本文介绍了如何打开在Linux中的程序的多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说,开​​的gedit 编辑器的多个实例,我写了一个shell脚本这样的 -

  gedit的&安培;
gedit的&安培;
gedit的&安培;
gedit的&安培;

但经过我跑我的shell脚本 ./ example.sh ,我能找到的只有一个gedit的实例!我甚至使用了&安培; 运营商,从而使外壳不会等待一个实例来完成。我仍然无法看到的的gedit 四个实例。

此外,我直接从命令提示符尝试。如果我只需要输入 gedit的&安培; 在命令行上,这表明 1906年(这是新创建的PID 的gedit 工艺),开始一种新的的gedit 实例,并返回再次提示。当我键入​​ gedit的&安培; 在命令行上,这表明 1909年<​​/ code>这个时间,但gedit中没有新的实例!我不能找到 PID 1909年<​​/ code>在系统监视器过于任何进程。这种新工艺到哪里去了?

时的发生具体到的gedit ?如果是这样,什么是创建一个程序的多个实例时,一般的行为?


解决方案

这是特定于gedit的。你很可能会寻找的gedit --new窗口和放大器;

男人的gedit


   - 新窗口
       在gedit中的现有实例创建一个新的顶层窗口。


Say for example, to open multiple instances of gedit editor I wrote a shell script like this-

gedit&
gedit&
gedit&
gedit&

But after I ran my shell script ./example.sh, I can find only one instance of gedit! I've even used the & operator, so that the shell doesn't wait for one instance to finish. Still I cannot see four instances of gedit.

Also I tried directly from the command prompt. If I just enter gedit& on the command line, it showed 1906 ( this is the PID of the newly created gedit process ), started one new gedit instance and returned to prompt again. When I typed gedit& on the command line, it showed 1909 this time, but no new instance of gedit! And I couldn't find any process with PID 1909 in the System Monitor too. Where did this new process go away?

Is the happening specific to gedit? If so, what is the generic behavior when creating multiple instances of a program?

解决方案

It is specific to gedit. You are likely looking for gedit --new-window &.

From man gedit:

--new-window
       Create a new toplevel window in an existing instance of gedit.

这篇关于如何打开在Linux中的程序的多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆