From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28555 invoked by alias); 2 Sep 2010 14:30:37 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15354 Received: (qmail 27713 invoked from network); 2 Sep 2010 14:30:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Thu, 2 Sep 2010 15:30:26 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: Problems with zsh's job control and running jobs Message-ID: <20100902153026.192301a3@csr.com> In-Reply-To: <20100902134747.GA30650@whistler.venod.com> References: <20100902134747.GA30650@whistler.venod.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Sep 2010 14:30:26.0917 (UTC) FILETIME=[62E41950:01CB4AAB] X-Scanned-By: MailControl A-06-00-00 (www.mailcontrol.com) on 10.68.0.115 On Thu, 2 Sep 2010 15:47:47 +0200 Haakon Riiser 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 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