From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3) with ESMTP id VAA16590 for ; Tue, 14 May 1996 21:40:48 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id HAA10253; Tue, 14 May 1996 07:26:13 -0400 (EDT) Resent-Date: Tue, 14 May 1996 07:26:13 -0400 (EDT) Message-Id: <199605141125.NAA06542@hydra.ifh.de> To: zsh-workers@math.gatech.edu Subject: Re: exit status of jobs In-reply-to: "venus!juno!harman@hclhprnd.hclt.com"'s message of "Tue, 14 May 1996 08:56:03 +0530." <9605140326.AA09367@juno.venus.hclt.com> Date: Tue, 14 May 1996 13:25:43 +0200 From: Peter Stephenson Resent-Message-ID: <"_5sIY1.0.7W2.Kt6cn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1069 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > In bash 1.13.5 (at least), the jobs command returns a > meaningful exit status. This feature has been used in various > bash scripts to determine whether a job is running or not. This does seem perfectly reasonable: at the moment you get the error message `no such job' and return status 0 which is inconsistent. I've assumed typing `jobs' with no argument should not return an error if there are no jobs (as in bash). *** Src/builtin.c.jobs Fri May 10 13:32:12 1996 --- Src/builtin.c Tue May 14 13:22:26 1996 *************** *** 563,570 **** /* The only type of argument allowed now is a job spec. Check it. */ job = (*argv) ? getjob(*argv, name) : firstjob; firstjob = -1; ! if (job == -1) break; if (!(jobtab[job].stat & STAT_INUSE) || (jobtab[job].stat & STAT_NOPRINT)) { zwarnnam(name, "no such job: %d", 0, job); --- 563,572 ---- /* The only type of argument allowed now is a job spec. Check it. */ job = (*argv) ? getjob(*argv, name) : firstjob; firstjob = -1; ! if (job == -1) { ! retval = 1; break; + } if (!(jobtab[job].stat & STAT_INUSE) || (jobtab[job].stat & STAT_NOPRINT)) { zwarnnam(name, "no such job: %d", 0, job); -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330 Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.