Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eye of Gnome - Open two images on different windows with shell script

Tags:

c++

shell

It might sound like a stupid question by I'm trying to work this out for a while but I can't figure out how to solve it.

I have two images named imagem.bmp and imagem2.bmp and a shell script that is supposed to open these two images using eye of gnome. I have written this in the script:

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

The problem is that only one image is opened, i.e., eog opens the first image and then the second image is loaded in the same screen. All I need is to open it in two separate screens so that i can compare the images.

like image 484
Guilherme Salomé Avatar asked Jun 08 '12 23:06

Guilherme Salomé


2 Answers

The help text is always useful:

$ 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

Notice this option:

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

Instead of running eog, run eog -n to open a new instance.

like image 194
Blender Avatar answered Nov 17 '22 09:11

Blender


bash waits for one command to finish executing before starting another. You can use & to execute a program "in the background". Try this:

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

I also fixed the /usr/bash bug.

Strictly speaking, the second line doesn't need the &, but this will return your prompt to you faster, without waiting for the second eog process to terminate.

like image 42
sarnold Avatar answered Nov 17 '22 08:11

sarnold