zsh-workers
 help / color / mirror / code / Atom feed
* exit status of jobs
@ 1996-05-14  3:26 Harmanjit Singh
  1996-05-14 11:25 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Harmanjit Singh @ 1996-05-14  3:26 UTC (permalink / raw)
  To: zsh-workers


Hello,
	I am using zsh 2.6beta13 on sparc-icl-sysv4.2.

	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 could be useful, I guess.  Could it be incorporated?
	Only a trivial modification is needed.

Regards,
Harmanjit Singh.

P.S. I am new on this list, so please forgive any newbieness.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: exit status of jobs
  1996-05-14  3:26 exit status of jobs Harmanjit Singh
@ 1996-05-14 11:25 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1996-05-14 11:25 UTC (permalink / raw)
  To: zsh-workers

> 	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@ifh.de>       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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-05-14 11:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-14  3:26 exit status of jobs Harmanjit Singh
1996-05-14 11:25 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).