Zsh Mailing List Archive
Messages sorted by:
Re: fg jobs info
- X-seq: zsh-users 11806
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: fg jobs info
- Date: Tue, 04 Sep 2007 08:31:04 -0700
- In-reply-to: <20070903163147.GA14017@mastermind>
- In-reply-to: <20070904111631.81486.qmail@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070902154306.35880.qmail@xxxxxxxxxxx> <070902105953.ZM22915@xxxxxxxxxxxxxxxxxxxxxx> <20070903163147.GA14017@mastermind> <20070904111631.81486.qmail@xxxxxxxxxxx>
On Sep 3, 12:31pm, Matthew Wozniski wrote:
} Subject: Re: fg jobs info
} On Sun, Sep 02, 2007 at 10:59:53AM -0700, Bart Schaefer wrote:
} > The "jobs" command should accept all the same job-identifier patterns
} > as "fg", and in recent zsh "jobs" doesn't lose track of the job list
} > when run in a subshell
} In how recent a zsh? I can't seem to get that working with 4.3.4.
You're right. $(jobs) and (jobs) produce different output. I thought
that because the latter worked, the former would also.
Looks to me as if there's a bug here; compare
Also, although "jobs" or "jobs -l" prints out the entire jobs listing
even in subshells/pipelines/etc., "jobs %2" (for example) produces a
"no such job" error, which surprised me. That should at least be
sleep 40 & sleep 30 &
jobs | cat
jobs %1 | cat
So the easy way out is not going to work here after all.
On Sep 4, 11:16pm, Atom Smasher wrote:
} On Sun, 2 Sep 2007, Bart Schaefer wrote:
} > Have a look at the variables jobdirs, jobtexts, and jobstates in the
} > zsh/parameter module. Or there's a lazier way out:
} that seems reasonably elegant... as long as a) there's only one
} suspended job or b) jobs are only referred to by number :(
} if the there's more than one job and either 1) the current job is
} implied or 2) a job is specified not by job number, things get messy.
Not all *that* messy. "The current job" is
Something like "fg %fred" is
And "fg %?wilma" is
Then you just do
} also, here's a case where (given what i'm trying to do) i'm confident
} that anything would fail (at least partially), short of some
} non-trivial updates to zsh:
} % fg %1 %2
You just have to handle that inside your "fg" function.
[[ -z $1 ]] && set -- %+
# Still ignoring all sorts of error handling here ...
case $jobspec in
# Need more quoting than shown for $jobspec below
builtin fg %$jobno
Jobs don't get renumbered as others exit, so the jobspecs that come in
are usable throughout.
The case that's going to be pretty difficult to handle is:
(That is, bringing a job to the foreground by simply typing its job spec.
Probably need a preexec function to catch that one.)
Incidentally, yet another bug:
% sleep 30 & sleep 50 &
% fg %- %-
 - running sleep 30
fg: %3: no such job
Where did I ever ask for job 3 ?
Messages sorted by: