From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3402 invoked from network); 24 Dec 1999 15:32:27 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 24 Dec 1999 15:32:27 -0000 Received: (qmail 18246 invoked by alias); 24 Dec 1999 15:32:17 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2806 Received: (qmail 18239 invoked from network); 24 Dec 1999 15:32:16 -0000 X-Authentication-Warning: pilau.atm.ox.ac.uk: iwi owned process doing -bs Date: Fri, 24 Dec 1999 15:32:14 +0000 (GMT) From: Alan Iwi Reply-To: Alan Iwi To: zsh-users@sunsite.auc.dk Subject: RE: checking jobs when zsh exits Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII tjlists@bigfoot.com wrote: > Also, fyi, the zsh-user@math.gatech.edu address is obsolete... Okay, thanks. I've got myself onto the list now, so I'll stay subscribed for at least long enough to catch any replies (longer if I get keen :-)). > Here's my hack-script, which I call "jobout" and then have: > alias x='source jobout' Thanks very much. Sorry, I'd failed to mention I've already got a hack (some lines in .zshrc) so that just typing "exit" does approximately the desired thing. I was just a bit unsure about posting code to the list, but in case it's useful here it is (see below). It works, but it would be nice to avoid hackiness. Happy Christmas. Alan #---------------------------------------------------------------------- disown_running() { # disown running jobs tmpfile==(:) jobs -r > $tmpfile running=`awk '{gsub("[][]","",$1);print "%"$1}' < $tmpfile` if [ -n "$running" ] ; then disown $running; fi # check for remaining jobs jobs >! $tmpfile [ -z "`<$tmpfile`" ] ; retval=$? /bin/rm $tmpfile # returns 1 if jobs still remaining, else 0 return $retval } if [ "$PS1" != "" ] then exit() { disown_running && builtin exit "$@" echo "You have stopped jobs:" jobs select name in 'exit anyway' 'return to prompt' do case $name in 'exit anyway') builtin exit "$@" ;; 'return to prompt') return ;; esac done } fi alias logout='exit' #----------------------------------------------------------------------