From owner-freebsd-questions@FreeBSD.ORG Wed Jul 30 02:42:28 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00889106566B for ; Wed, 30 Jul 2008 02:42:28 +0000 (UTC) (envelope-from perrin@apotheon.com) Received: from outbound-mail-32.bluehost.com (outbound-mail-32.bluehost.com [69.89.18.152]) by mx1.freebsd.org (Postfix) with SMTP id C481F8FC08 for ; Wed, 30 Jul 2008 02:42:27 +0000 (UTC) (envelope-from perrin@apotheon.com) Received: (qmail 6575 invoked by uid 0); 30 Jul 2008 02:42:24 -0000 Received: from unknown (HELO box183.bluehost.com) (69.89.25.183) by outboundproxy2.bluehost.com with SMTP; 30 Jul 2008 02:42:24 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=apotheon.com; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:Mime-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:X-Identified-User; b=Ro5h/qPeg/bgH04E9O4wTTnC7fa6NSC/fEKuV2pzLimxuKJh0P8NY3dHeU14EO718BrOFkXn+cAhlIMIuXg6dbPQY86zgtuzXnqIDxW3b4SmSQ451kOXzIAN77PgAewI; Received: from c-24-8-180-234.hsd1.co.comcast.net ([24.8.180.234] helo=kokopelli.hydra) by box183.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1KO1dw-0007Gd-8r for freebsd-questions@freebsd.org; Tue, 29 Jul 2008 20:42:24 -0600 Received: by kokopelli.hydra (sSMTP sendmail emulation); Tue, 29 Jul 2008 20:36:21 -0600 Date: Tue, 29 Jul 2008 20:36:21 -0600 From: Chad Perrin To: FreeBSD Questions Message-ID: <20080730023246.GE36138@kokopelli.hydra> Mail-Followup-To: FreeBSD Questions References: <20080729181904.GA35291@kokopelli.hydra> <488F68E2.2090409@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dgjlcl3Tl+kb3YDk" Content-Disposition: inline In-Reply-To: <488F68E2.2090409@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Identified-User: {737:box183.bluehost.com:apotheon:apotheon.org} {sentby:smtp auth 24.8.180.234 authed with ren@apotheon.org} Subject: Re: formatting the time in tcsh prompt X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2008 02:42:28 -0000 --dgjlcl3Tl+kb3YDk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 29, 2008 at 03:00:50PM -0400, Greg Larkin wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 > Chad Perrin wrote: > | This might be slightly off-topic, I suppose -- but since (t)csh is the > | default shell for FreeBSD, I figured this might be a good place to ask. > | > | I'm aware of the %T option for showing 24-hour time in my tcsh prompt, > | but it doesn't do exactly what I would like. Inserting a call to the > | date command so I can have the exact formatting I want appears to fail = by > | only calculating the time once, and showing the same time every time the > | prompt appears -- which means that, several hours later, I'm still > | looking at the time from when the shell instance was started. > | > | The prompt setting using the date command that I used is as follows: > | > | set prompt =3D "[`date +'%H%M'`] %~%# " > | > ... > | There must be some way to do this. Right? > | >=20 > Hi Chad, >=20 > Right! Try this: >=20 > set prompt=3D' % ' > alias precmd 'printf "[%s]" "`date +'%H%M'`"' Most excellent! Thank you. --=20 Chad Perrin [ content licensed PDL: http://pdl.apotheon.org ] Peter Norvig: "Use the most natural notation available to solve the problem, and then worry about writing an interpreter for that notation." --dgjlcl3Tl+kb3YDk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkiP06UACgkQ9mn/Pj01uKVvrACdGhyymnvQ+na90WRj7NZ6ZTX9 WRUAn0HeJ64rXiwXgZ47Bz41j7VjwQB3 =iIBE -----END PGP SIGNATURE----- --dgjlcl3Tl+kb3YDk--