#!/bin/sh

# Return the pids of jobs that contain $1 in their names.
# But, actually, there are some weird situations in which there might
# be no such job, but this command returns some pids because $1
# appears in inappropriate fields in the output of ps.

(genps | head -n 1; genps | grep "$1" | grep -v "grep $1" | grep -v "$0 $1") \
   | excol 'PID' | tail -n +2
