Date: Fri, 11 Jun 1999 16:45:01 +0100 From: Ben Smithurst <ben@scientia.demon.co.uk> To: Bart Trzynadlowski <trzy@powernet.net> Cc: Mark Ovens <markov@globalnet.co.uk>, freebsd-questions@freebsd.org Subject: Re: prompts Message-ID: <19990611164501.A281@rainbow5.scientia.demon.co.uk> In-Reply-To: <Pine.BSF.4.05.9906102016310.688-100000@Brzuszek> References: <19990611014637.G255@marder-1> <Pine.BSF.4.05.9906102016310.688-100000@Brzuszek>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990611164501.A281>