From owner-freebsd-questions Thu Jul 20 21:40:19 2000 Delivered-To: freebsd-questions@freebsd.org Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id D317D37B528 for ; Thu, 20 Jul 2000 21:40:15 -0700 (PDT) (envelope-from jhb@pike.osd.bsdi.com) Received: (from jhb@localhost) by pike.osd.bsdi.com (8.9.3/8.9.3) id VAA38937; Thu, 20 Jul 2000 21:38:23 -0700 (PDT) (envelope-from jhb) From: John Baldwin Message-Id: <200007210438.VAA38937@pike.osd.bsdi.com> Subject: Re: Setting shell prompt for C-shell In-Reply-To: <20000721095347.A9557@physics.iisc.ernet.in> from Rahul Siddharthan at "Jul 21, 2000 09:53:47 am" To: Rahul Siddharthan Date: Thu, 20 Jul 2000 21:38:22 -0700 (PDT) Cc: djkanter@northwestern.edu, freebsd-questions@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Alfred Perlstein said on Jul 20, 2000 at 18:45:59: > > * David J. Kanter [000720 18:22] wrote: > > > I'm having trouble customizing the shell prompt for csh. I'd like to have: > > > > > > pwd % (ex. /home/david % or /usr/bin % ...) > > > > > > In my .cshrc I have: > > > > > > set prompt="`pwd` % " > > > > > > Which works fine upon start-up (/home/david % ) but doesn't change as I make > > > my way through various directories. Look... > > > `pwd` gets evaluated right then and there, not every time you > > hit enter, try this instead: > > > > set prompt="%~ >" This only works in tcsh, and "%/ >" more closely matches what the original poster requested. > What is that supposed to do? When I try it I simply get a prompt like > %~ > (this is with /bin/csh on 3.4) Yes, csh dosen't handle % escapes in the prompt. > and > ~ > (with tcsh on the same machine) Try changing to a different directory, then read the manpage for tcsh. :) Basically, %~ is like %/, but it will use ~ for your home directory, and ~foo for foo's home directory instead of the actual path. If you typically log into several machines, then a prompt such as "%B%n@%m%b:%~\n%# " can be useful. It would render as follows: john@john:~ > but with the username and machine in bold. > > Please see the shell's manpage (man csh), in ancient and more > > barbaric times someone would show up at your door for forking pwd > > every time you hit enter. > > What I use is something like this: > alias cd 'cd \!*; set prompt="\! `pwd`>"' > > which sets the prompt afresh every time you use cd. Is that what you > mean above? That works, but is only necessary for archaic shells like the original csh or sh. > Rahul. -- John Baldwin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message