From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3042 invoked by alias); 25 Sep 2011 17:39:42 -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: 16428 Received: (qmail 9530 invoked from network); 25 Sep 2011 17:39:40 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110925103934.ZM19149@torch.brasslantern.com> Date: Sun, 25 Sep 2011 10:39:34 -0700 In-reply-to: Comments: In reply to Daniel "Re: named jobs in RPROMPT" (Sep 20, 7:27am) References: <25285513.300695.1316475776167.JavaMail.servlet@pustefix152.kundenserver.de> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: named jobs in RPROMPT MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 20, 7:27am, Daniel wrote: } Subject: Re: named jobs in RPROMPT } } setopt promptsubst } Now consider: } RPROMPT='"$jobstates"' } and } my_jobs() { print $jobstates } } RPROMPT='"$(my_jobs)"' } } The first one display the jobstates array, the second doesn't. That's because $(...) is a subshell which has no jobs of its own. Consider: sleep 10 & print $jobtexts print $(sleep 3 >/dev/null & print $jobtexts) print $jobtexts } My idea is to have my_jobs print a very compact list of jobs, fitting in } the right prompt. Instead of having my_jobs print the list to stdout, which forces you to create a sub-process whose output can be captured, just have my_jobs assign the list directly to RPROMPT.