Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problems with zsh's job control and running jobs
- X-seq: zsh-users 15354
- From: Peter Stephenson <Peter.Stephenson@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Problems with zsh's job control and running jobs
- Date: Thu, 2 Sep 2010 15:30:26 +0100
- In-reply-to: <20100902134747.GA30650@xxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
- References: <20100902134747.GA30650@xxxxxxxxxxxxxxxxxx>
On Thu, 2 Sep 2010 15:47:47 +0200
Haakon Riiser <haakon.riiser@xxxxxxxxxx> wrote:
> If not, is it possible to make "&" disown jobs by default?
I got this to work. It assumes your zsh is recent enough that (i) you have
hook functions and the add-zsh-hook function --- else you need to use
precmd (ii) "jobs" works in the left hand side of a pipeline --- else
you need to use a temporary file.
precmd_disown() {
emulate -L zsh
setopt extendedglob
local job match mbegin mend
jobs | while read job; do
if [[ $job = \[(#b)([[:digit:]]##)\]*running* ]]; then
disown %$match[1]
fi
done
}
autoload -U add-zsh-hook
add-zsh-hook precmd precmd_disown
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author