From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6385 invoked from network); 18 Jun 1997 07:35:32 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 18 Jun 1997 07:35:32 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id DAA22905; Wed, 18 Jun 1997 03:21:58 -0400 (EDT) Resent-Date: Wed, 18 Jun 1997 03:21:33 -0400 (EDT) X-Authentication-Warning: dreamer.accesscom.com: talby owned process doing -bs Date: Wed, 18 Jun 1997 00:25:30 -0700 (PDT) From: Robert Stone X-Sender: talby@dreamer To: zsh-users@math.gatech.edu Subject: kill and pid files Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Resent-Message-ID: <"mKvmL3.0.Ub5.ynufp"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/901 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I find myself using "kill -HUP $(cat /var/run/.pid)" constantly... in fact, as root I use that line much more often than using a literal pid. Is there any reason kill should not take a filename as an argument? i.e. if the job specification is not a legal job name, or a legal pid, why not try to open a file with that name and see if it's first line is a valid pid? Here's the idea, but this thing is horribly slow at times. function mykill { args=() if ! kill "$argv[@]" 2> /dev/null then while [ "$argv" ] do case "$argv[1]" in -s) args=("$args[@]" "$argv[1]" "$argv[2]") shift 2 ;; -l) args=("$args[@]" "$@") shift "$#" ;; -*) args=("$args[@]" "$argv[1]") shift ;; *) if echo "$argv[1]" | egrep -q '^%[0-9]+$' then args=("$args[@]" "$argv[1]") shift elif echo "$argv[1]" | egrep -q '^[0-9]+$' then args=("$args[@]" "$argv[1]") shift elif [ -f "$argv[1]" ] && head -1 "$argv[1]" | egrep -q '^[0-9]+$' then args=("$args[@]" "$(head -1 "$argv[1]")") shift else args=("$args[@]" "$argv[1]") shift fi ;; esac done kill "$args[@]" fi }