#!/usr/bin/perl
# findpids
use strict;
use warnings;
use Unix::PID;
use Getopt::Long;
my $cmd = '';
GetOptions(
'command=s' => \$cmd,
);
my $pobj = Unix::PID->new;
print join(' ',$pobj->get_pidof($cmd)),"\n";
####
ivor@orinoco:~$ kill -19 `findpids --command btdownloadgui`
ivor@orinoco:~$ jobs
[1] Stopped nice btdownloadgui --saveas ${fil%.torrent} $torrent (wd: ~)
[2]+ Stopped nice btdownloadgui --saveas ${fil%.torrent} $torrent (wd: ~)
[3] Stopped nice btdownloadgui --saveas ${fil%.torrent} $torrent (wd: ~)
[5] Stopped nice btdownloadgui --saveas ${fil%.torrent} $torrent (wd: ~)
[6] Stopped nice btdownloadgui --saveas ${fil%.torrent} $torrent (wd: ~)
[7] Stopped nice btdownloadgui --saveas ${fil%.torrent} $torrent (wd: ~)
[8] Stopped nice btdownloadgui --saveas ${fil%.torrent} $torrent (wd: ~)
[9]- Stopped nice btdownloadgui --saveas ${fil%.torrent} $torrent (wd: ~)
####
ivor@orinoco:~$ kill -18 `findpids --command btdownloadgui`