Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Functions that start Jobs



On Thu, Jun 28, 2001 at 05:07:38PM -0700, Bart Schaefer wrote:
> On Jun 28,  3:33pm, Gregory Margo wrote:
> > Subject: Functions that start Jobs
> > I have a Function that starts a process in the background.
> > The Job created is "%2" instead of "%1".
> > Why is this?
> 
> Because the function itself is job %1.  It doesn't show up in the output
> of "jobs" because it's being executed within the current shell process,
> but it still has a job table entry.
> 
> > How can I make it be the first Job?
> 
> You can't.  Even if the function didn't use up one job slot, what if
> there were some other background job already running?
> 
> Why is it important that it be the first job?

Consistancy.  I've used this alias and others, with job control under
several shells, for many years.

If I type it on the command line, it's job %1.
If I make it a zsh alias, without the $*, then it's job %1.
When I used csh/tcsh, my alias created job %1.
When I used bash, my function (same as zsh function) created job %1.

In general, when I put something in the background (nothing else already
there) then I expect it to be job %1.

Why does a function take up a job slot?
And if it does, why doesn't 'exec' work?

thanks,
gm
-- 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Gregory H. Margo
Home: gmargo@xxxxxxxxx
Work: gmargo@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author