From owner-freebsd-questions Thu Jun 10 18:18:37 1999 Delivered-To: freebsd-questions@freebsd.org Received: from sand2.global.net.uk (sand2.global.net.uk [194.126.80.50]) by hub.freebsd.org (Postfix) with ESMTP id 3EA3E14D09 for ; Thu, 10 Jun 1999 18:18:34 -0700 (PDT) (envelope-from marko@globalnet.co.uk) Received: from pfds08a06.client.global.net.uk ([195.147.216.254] helo=marder-1.) by sand2.global.net.uk with esmtp (Exim 2.05 #1) id 10sFxo-00078S-00; Fri, 11 Jun 1999 02:18:33 +0100 Received: (from marko@localhost) by marder-1. (8.9.2/8.8.8) id BAA00842; Fri, 11 Jun 1999 01:46:38 +0100 (BST) (envelope-from marko) Date: Fri, 11 Jun 1999 01:46:38 +0100 From: Mark Ovens To: Bart Trzynadlowski Cc: freebsd-questions@freebsd.org Subject: Re: prompts Message-ID: <19990611014637.G255@marder-1> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: ; from Bart Trzynadlowski on Thu, Jun 10, 1999 at 04:20:37PM -0700 Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Jun 10, 1999 at 04:20:37PM -0700, Bart Trzynadlowski wrote: > Hello, > I'd like to thank everyone for helping me out with the email > issue. I decided to stick with Pine and just change my login name to > "trzy". > > I asked earlier about prompts under csh and sh but I still haven't been > able to change them. I want the prompts to display the current directory > followed by a # or $ depending on the user class. > My zsh prompt looks like this: > > /home/trzy% > > But my sh prompt is just a "$" or "#" and my csh prompt prints the > hostname followed by a # or $. The csh man page says that the cwd variable > lists the current working directory and is modified each time the > directory is changed via cd. So I tried setting the prompt like this: > > set prompt = "$cwd#" > > Csh is for my root account and when I logged in as root I got to > experience what follows: > > /root# cd .. > /root# cd /home/trzy > /root# > > thus cwd is not changing with each cd. > > Any ideas for csh and sh? > For csh you need to alias ``cd''. If you just do a ``set prompt='' like you tried then it is static, that is you set the variable "prompt" to the value it was at that point in time (actually, what you did was wrong anyway, you needed ``set prompt = "`echo $cwd`#") You need to update the variable "prompt" every time you ``cd''. To get what you want, add the following to ~/.cshrc (so it applies to all shells that you start): alias cd 'cd \!*;set prompt="`pwd`# "' % % cd % alias cd 'cd \!*;set prompt="`pwd`# "' % % % cd /usr/marko# cd /etc /etc# cd /mnt /mnt# HTH > Thanks a lot! > > Bart Trzynadlowski > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > -- FreeBSD - The Power To Serve http://www.freebsd.org My Webpage http://www.users.globalnet.co.uk/~markov _______________________________________________________________ Mark Ovens, CNC Apps Engineer, Radan Computational Ltd. Bath UK CAD/CAM solutions for Sheetmetal Working Industry mailto:marko@uk.radan.com http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message