From owner-freebsd-questions@FreeBSD.ORG Mon May 14 03:37:52 2012 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 575A3106564A for ; Mon, 14 May 2012 03:37:52 +0000 (UTC) (envelope-from rloefgren@forethought.net) Received: from mzpi3.forethought.net (mzpi3.forethought.net [216.241.36.12]) by mx1.freebsd.org (Postfix) with ESMTP id 2B7BD8FC17 for ; Mon, 14 May 2012 03:37:52 +0000 (UTC) Received: from 216-241-45-95.static.forethought.net ([216.241.45.95] helo=auden.jmla.com) by mz1.forethought.net with esmtps (TLSv1:RC4-MD5:128) (Exim 4.69) (envelope-from ) id 1STZbP-0000XH-L8 for freebsd-questions@freebsd.org; Sun, 13 May 2012 08:16:51 -0600 Message-ID: <4FAFC253.5000200@forethought.net> Date: Sun, 13 May 2012 08:16:51 -0600 From: Reed Loefgren User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120425 Thunderbird/12.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4FAFAF7F.4010409@webrz.net> <20120513152509.09dbfc10.freebsd@edvax.de> In-Reply-To: <20120513152509.09dbfc10.freebsd@edvax.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: CSH 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: Mon, 14 May 2012 03:37:52 -0000 On 05/13/12 07:25, Polytropon wrote: > On Sun, 13 May 2012 14:56:31 +0200, Jos Chrispijn wrote: >> In cshell I use this prompt: set prompt = "%B[%@]%b %m[%/]> " >> The problem I face now is that if I use this prompt with symbolic links, >> the presented location is displaying the symbolic link rather than the >> real directory name. >> Is there a way of preventin this? > Yes, a very ugly way which I just found out: > > alias precmd 'set WD=`pwd`; set prompt = "%B[%@]%b %m[$WD]> "' > > Example: > > [3:21pm] r56[/]> cd /sys > [3:21pm] r56[/usr/src/sys]> _ > > It redefines the whole prompt at any command that could > affect the current working directory (not only "cd" can > do that). This is needed as any call to `pwd` stored into > a variable will only affect $prompt once - this is when > it's set, only at this time $WD would be evaluated. So > that's why this strange command. :-) > > Oh, and I just improved it. How about this? > > alias precmd 'set prompt = "%B[%@]%b %m[`pwd`]> "' > > Much better. :-) I've butchered it further, but thanks for doing the *real* work: user: alias precmd 'set prompt = "\n%{\033[32m%}%m [%h] [%@]%b%{\033[0m%} [`pwd`]$ "' root: alias precmd 'set prompt = "\n%{\033[31m%}%m [%h] [%@]%b%{\033[0m%} [`pwd`]$ "' Regards, r