From owner-freebsd-questions Fri Jun 11 9:44: 9 1999 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id DB2EE15277 for ; Fri, 11 Jun 1999 09:43:57 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from rainbow5.scientia.demon.co.uk ([192.168.1.2] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.02 #1) id 10sTUM-0001i7-00; Fri, 11 Jun 1999 16:45:02 +0100 (envelope-from ben@rainbow5.scientia.demon.co.uk) Received: from rainbow5.scientia.demon.co.uk (ident=ben) by rainbow5.scientia.demon.co.uk with local (Exim 3.02 #1) id 10sTUL-000055-00; Fri, 11 Jun 1999 16:45:01 +0100 (envelope-from ben@rainbow5.scientia.demon.co.uk) Date: Fri, 11 Jun 1999 16:45:01 +0100 From: Ben Smithurst To: Bart Trzynadlowski Cc: Mark Ovens , freebsd-questions@freebsd.org Subject: Re: prompts Message-ID: <19990611164501.A281@rainbow5.scientia.demon.co.uk> References: <19990611014637.G255@marder-1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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. No, I don't beleive it can. The shell must keep track of symlinks it follows, AIUI, which bash does, and zsh does too going by your description. (After you `cd /home', your current working directory *is* /usr/home (with the symlinks as above), as returned by getcwd(), but the shell keeps track of where you think you are, so `cd ..', etc, works appropriately. At least, I think it does, I haven't checked the code, but it must to something along those lines.) > But the alias for cd you gave me does not work under sh. I find bash much nicer for interactive use than sh. (Well, a bit nicer, anyway.) Bash can do what you want with PS1='\w\$ ' or similar, though similar solutions exist for sh: try searching this list's archives from www.freebsd.org. > 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. In your shell initialization file, case `id -u` in 0) PS1="`pwd`# ";; *) PS1="`pwd1$ ";; esac should do what you want, in a sh-type shell. csh probably has similar constructs, check the manpage. In my bash PS1, I have '\$', which expands automatically to "#" if uid == 0, else it expands to "$". -- Ben Smithurst | PGP: 0x99392F7D ben@scientia.demon.co.uk | key available from keyservers and | ben+pgp@scientia.demon.co.uk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message