From owner-freebsd-questions@FreeBSD.ORG Tue Jul 29 18:25:09 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 CA43A1065671 for ; Tue, 29 Jul 2008 18:25:09 +0000 (UTC) (envelope-from perrin@apotheon.com) Received: from outbound-mail-118.bluehost.com (outbound-mail-118.bluehost.com [69.89.22.18]) by mx1.freebsd.org (Postfix) with SMTP id 9717A8FC14 for ; Tue, 29 Jul 2008 18:25:09 +0000 (UTC) (envelope-from perrin@apotheon.com) Received: (qmail 5151 invoked by uid 0); 29 Jul 2008 18:25:06 -0000 Received: from unknown (HELO box183.bluehost.com) (69.89.25.183) by outboundproxy3.bluehost.com with SMTP; 29 Jul 2008 18:25:06 -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:Mime-Version:Content-Type:Content-Disposition:User-Agent:X-Identified-User; b=ADDMuOVbMVnmuIo71nB6axbTYELyl335mfpnN8JGcMzJ4G+afSQa16sDfN4jrVS5VSEn31aY6YPdvVolRyJ18IyeGPczWfaSIfR9XoOypKBTTR6P5ZFtmPJEaleD4gkt; 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 1KNtsg-00038c-GL for freebsd-questions@freebsd.org; Tue, 29 Jul 2008 12:25:06 -0600 Received: by kokopelli.hydra (sSMTP sendmail emulation); Tue, 29 Jul 2008 12:19:04 -0600 Date: Tue, 29 Jul 2008 12:19:04 -0600 From: Chad Perrin To: FreeBSD Questions Message-ID: <20080729181904.GA35291@kokopelli.hydra> Mail-Followup-To: FreeBSD Questions Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline 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: 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: Tue, 29 Jul 2008 18:25:09 -0000 --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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'`] %~%# " At nine in the morning, that gives me: [0900] ~> =2E . . whereas the tcsh native time formatting for 24-hour time is: set prompt =3D "[%T] %~%# " At nine in the morning, that gives me: [9:00] ~> I would prefer to not have the colon in there, but it's not a big deal. The biggest annoyance is the fact that the length of the time string changes depending on whether it's an AM time or a PM time. This is the best I've been able to get so far for a timestamp in the prompt that updates every time the prompt is displayed: [9:00] ~> This is acceptable: [09:00] ~> This is most preferred: [0900] ~> There must be some way to do this. Right? --=20 Chad Perrin [ content licensed PDL: http://pdl.apotheon.org ] Jon Postel, RFC 761: "[B]e conservative in what you do, be liberal in what you accept from others." --jRHKVT23PllUwdXP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkiPXxgACgkQ9mn/Pj01uKW8CQCguXwLZ8+ndGpZcF0xpFCFytJ1 QRIAoIueP+4IhNtMdUakufqb2IppFG3m =pjzF -----END PGP SIGNATURE----- --jRHKVT23PllUwdXP--