Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: exit status of jobs
- X-seq: zsh-workers 1069
- From: Peter Stephenson <pws@xxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: exit status of jobs
- Date: Tue, 14 May 1996 13:25:43 +0200
- In-reply-to: "venus!juno!harman@xxxxxxxxxxxxxxxxx"'s message of "Tue, 14 May 1996 08:56:03 +0530."             <9605140326.AA09367@xxxxxxxxxxxxxxxxxxx> 
> 	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 <pws@xxxxxx>       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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author