Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jun 1999 01:46:38 +0100
From:      Mark Ovens <markov@globalnet.co.uk>
To:        Bart Trzynadlowski <trzy@powernet.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: prompts
Message-ID:  <19990611014637.G255@marder-1>
In-Reply-To: <Pine.BSF.4.05.9906101615410.393-100000@Brzuszek>; from Bart Trzynadlowski on Thu, Jun 10, 1999 at 04:20:37PM -0700
References:  <Pine.BSF.4.05.9906101615410.393-100000@Brzuszek>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990611014637.G255>