[sf-perl] simultaneous processes?

Steve Fink sphink at gmail.com
Fri Mar 5 13:55:39 PST 2010


I'm also a little confused by exactly what you're trying to accomplish.

Is this correct: you want to scan over a large set of tiff files. For
each one, you want to pop up an image viewer and a shell. When you've
figured out what to do with the image, you type a command into the
shell and then you want both the shell and the view of that image to
go away, and then you move onto the next one. Is that it?

If so, the "safe" way to do it (and not worry about quoting and
things) would be something like

for my $file (glob("*.tiff")) {
  my $viewer = fork() || exec("evince", $file) || die;
  system("gnome-terminal", "--geometry=50x35-0+0");
  kill(15, $viewer) if kill(0, $viewer);
  wait;
}

(warning: completely untested)

Though if I was right about what you're doing, then wouldn't it be
better to have the script prompt you for what you want to do with each
image instead of starting up a terminal for it?

I'm probably just confused about what you're after.


More information about the SanFrancisco-pm mailing list