Gnome之眼 - 使用shell脚本在不同的窗口上打开两个图像

时间:2012-06-08 23:55:09

标签: c++ shell

这可能听起来像是一个愚蠢的问题,我试图解决这个问题一段时间,但我无法弄清楚如何解决它。

我有两个名为imagem.bmpimagem2.bmp的图像以及一个应该使用gnome眼睛打开这两个图像的shell脚本。我在剧本中写了这个:

#!/usr/bash
eog imagem.bmp
eog imagem2.bmp

问题是只打开一个图像,即,eog打开第一个图像,然后第二个图像被加载到同一个屏幕中。我只需要在两个单独的屏幕上打开它,以便我可以比较图像。

2 个答案:

答案 0 :(得分:6)

帮助文本总是很有用:

$ eog --help
Usage:
  eog [OPTION...] [FILE…]

Help Options:
  -h, --help                         Show help options
  --help-all                         Show all help options
  --help-gtk                         Show GTK+ Options

Application Options:
  -f, --fullscreen                   Open in fullscreen mode
  -c, --disable-image-collection     Disable image collection
  -s, --slide-show                   Open in slideshow mode
  -n, --new-instance                 Start a new instance instead of reusing an existing one
  --version                          Show the application's version
  --display=DISPLAY                  X display to use

请注意此选项:

-n, --new-instance       Start a new instance instead of reusing an existing one

运行eog以打开新实例,而不是运行eog -n

答案 1 :(得分:2)

bash在启动另一个命令之前等待一个命令完成执行。您可以使用&“在后台”执行程序。试试这个:

#!/bin/bash
eog imagem.bmp &
eog imagem2.bmp &

我还修复了/usr/bash错误。

严格来说,第二行不需要&,但这会更快地向您返回提示,而不会等待第二个eog进程终止。