From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16370 invoked from network); 1 Oct 2001 06:13:47 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Oct 2001 06:13:47 -0000 Received: (qmail 16616 invoked by alias); 1 Oct 2001 06:13:36 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4301 Received: (qmail 16604 invoked from network); 1 Oct 2001 06:13:35 -0000 Date: Mon, 1 Oct 2001 02:12:22 -0400 From: Sweth Chandramouli To: zsh-users@sunsite.dk Subject: Re: get the number of active jobs to show in the prompt? Message-ID: <20011001021221.A4623@astaroth.sweth.net> Mail-Followup-To: zsh-users@sunsite.dk References: <200110010600.f9160iq10821@bang.houseoflove> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200110010600.f9160iq10821@bang.houseoflove> --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 30, 2001 at 10:56:50PM -0700, Drew Perttula wrote: >=20 > Hello everyone- >=20 > I'm tired of using my close-window shortcut to zap shells > that still owned running programs, so I'd like my zsh prompt > to indicate that somehow. I can't figure out how to do anything > programmatically with the 'jobs' command (such as "jobs | wc -l"), > so I'm lost as to how to do my prompt trick. zsh spawns a subshell for the LHS of a pipe, rather than the RHS, which lets you do things like=20 $ do_something | read VAR and have VAR still be set. That means that jobs in your example is being run in a subshell where there _aren't_ any background jobs. The only way I can think of offhand to get the info from jobs would be to redirect the output of jobs to a temp file and then use that to build your prompt; that's not very efficient, however. I don't know if there's some other way to get that info from the shell. -- Sweth. --=20 Sweth Chandramouli ; President, Idiopathic Systems Consulting --2fHTh5uZTiUOsy+g Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (SunOS) Comment: For info see http://www.gnupg.org iEYEARECAAYFAju4CUQACgkQDm6vx6GSHlmZswCePwTF8RpY0dEYTVRb+wg94z5s zjAAoNgsPMwpb9IACbhQPvx/l6UI7Hyg =hQ6+ -----END PGP SIGNATURE----- --2fHTh5uZTiUOsy+g--