From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26738 invoked from network); 12 Sep 1997 17:57:43 -0000 Received: from math.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 12 Sep 1997 17:57:43 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id NAA29039; Fri, 12 Sep 1997 13:50:57 -0400 (EDT) Resent-Date: Fri, 12 Sep 1997 13:50:26 -0400 (EDT) From: Andrew Main Message-Id: <199709121750.SAA07577@taos.demon.co.uk> Subject: Re: can i have jobs in my prompt? To: fk5a005@rrz.uni-hamburg.de (Matthias Kopfermann) Date: Fri, 12 Sep 1997 18:50:30 +0100 (BST) Cc: zsh-users@math.gatech.edu In-Reply-To: <199709121736.TAA23418@rzaix43.rrz.uni-hamburg.de> from "Matthias Kopfermann" at Sep 12, 97 07:36:15 pm X-Loop: zefram@tao.co.uk X-Headers: in preparation X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"JaGhA.0.s47.X3O6q"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1014 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Note: I'm CCing this reply to zsh-users, as the answer is likely to be of general interest. Matthias Kopfermann wrote: >i forget how many jobs are running, especially if they are in the background. >what would you do here? > >-f4-7)-%{`builtin jobs`%}- Don't use %{%}. They are used to indicate a sequence that doesn't move the cursor, such as a colour escape sequence. Also, $() is recommended over ``, but in any case jobs doesn't work in a subshell. A possible approach would be to put something in precmd (a function run before each prompt) like this: function precmd { if jobs % >& /dev/null; then psvar=("*") else psvar=("") fi } And then put "%1v" in your prompt, for example: PROMPT="%1v> " and this will put a * in your prompt if there are any background jobs. You can substitute any other sequence. I think I might start using this myself. -zefram