From owner-freebsd-questions Fri Jun 11 10: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 6998614FCC for ; Fri, 11 Jun 1999 10:18:27 -0700 (PDT) (envelope-from marko@globalnet.co.uk) Received: from p0bs11a06.client.global.net.uk ([195.147.219.12] helo=marder-1.) by sand2.global.net.uk with esmtp (Exim 2.05 #1) id 10sUwf-0004yt-00; Fri, 11 Jun 1999 18:18:23 +0100 Received: (from marko@localhost) by marder-1. (8.9.2/8.8.8) id SAA00328; Fri, 11 Jun 1999 18:15:59 +0100 (BST) (envelope-from marko) Date: Fri, 11 Jun 1999 18:15:58 +0100 From: Mark Ovens To: Bart Trzynadlowski Cc: freebsd-questions@freebsd.org Subject: Re: prompts Message-ID: <19990611181558.B255@marder-1> References: <19990611014637.G255@marder-1> 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 08:20:35PM -0700 Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Jun 10, 1999 at 08:20:35PM -0700, Bart Trzynadlowski wrote: > > > This works great in csh. There is one little quirk: when I cd to /home > (which is a link to /usr/home) it prints /usr/home and to go down to / I > have to issue cd .. twice. In zsh it prints /home and I only have to cd > .. once. Can this be fixed? Once again, its not a big deal though, just > curious. I don't think it can be changed. If it can I don't know how. > But the alias for cd you gave me does not work under sh. It was for csh only. For sh you set PWD I think. > And also, > the character # for superuser and $ or % for user... how does the shell > change this? For csh you put the alias in each users ~/.cshrc and for non-root users edit it, changing ``#'' to ``%''. Normally, if you don't set the ``prompt'' variable yourself, the shell uses % as the default for non-root users and # for root. > In zsh I think /# sets # for superuser and % for user. How > can I set the prompt up so that if I'm a superuser it > uses # and if I'm a user it uses $ under sh and csh. Do I just use "#"? I > tried doing > PS1="`pwd`# " > in sh but it printed # for the regular users. > > > > 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 > > > > > > > > -- 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