Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: fg jobs info
- X-seq: zsh-users 11809
- From: Atom Smasher <atom@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: fg jobs info
- Date: Wed, 5 Sep 2007 21:02:59 +1200 (NZST)
- In-reply-to: <070904083104.ZM25598@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Openpgp: id=0xB88D52E4D9F57808; algo=1 (RSA); size=4096; url=http://atom.smasher.org/pgp.txt
- References: <20070902154306.35880.qmail@xxxxxxxxxxx> <070902105953.ZM22915@xxxxxxxxxxxxxxxxxxxxxx> <20070903163147.GA14017@mastermind> <20070904111631.81486.qmail@xxxxxxxxxxx> <070904083104.ZM25598@xxxxxxxxxxxxxxxxxxxxxx>
maybe in the process of working out the bugs, there can be some added
functionality to add a variable that automagically returns the text of the
fg'd job.
in the meantime, i'm keeping it (relatively) simple and assuming that i've
only got one job at a time suspended (for me, that's a reasonable
assumption; YMMV). my preexec runs a function (to display the command name
in tabs, title bars, icons, etc), and part of the function is simply:
if [ 'fg' = "${${(z)@}[1]}" ]
then
cmnd_name="${(vV)jobtexts}"
fi
as far as i can tell, the worst case failure is that it will display the
commands of more than one job. considering the lengths i'd have to go
through to fix that, and the chances of introducing more bugs, and how
often i have multiple jobs suspended within a shell (not very often) i
think this is good enough, for now.
thanks...
On Tue, 4 Sep 2007, Bart Schaefer wrote:
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
print $(jobs)
(print $(jobs))
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
documented. Try:
sleep 40 & sleep 30 &
jobs | cat
jobs %1 | cat
So the easy way out is not going to work here after all.
~~~~~~~~~~~
Incidentally, yet another bug:
% sleep 30 & sleep 50 &
% fg %- %-
[1] - running sleep 30
fg: %3: no such job
Where did I ever ask for job 3 ?
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so."
-- Douglas Adams, Last Chance to See
Messages sorted by:
Reverse Date,
Date,
Thread,
Author