Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!umd5!uvaarpa!mcnc!decvax!decwrl!hplabs!hpda!hpsemc!bd From: bd@hpsemc.HP.COM (bob desinger) Newsgroups: comp.unix.questions Subject: Re: current pwd in prompt Message-ID: <810001@hpsemc.HP.COM> Date: 2 Mar 88 06:48:32 GMT References: <11656@brl-adm.ARPA> Organization: HP SEMC, Cupertino, CA Lines: 23 Geoffrey R. Walton (geoff@ncr-sd.SanDiego.NCR.COM) writes: > set prompt="\!:`uuname -l`:[`pwd`] " > alias pushd 'pushd \!* ; set prompt="\\!:`uuname -l`:[`pwd`] "' > alias popd 'popd ; set prompt="\\!:`uuname -l`:[`pwd`] "' > alias cd 'cd \!* ; set prompt="\\!:`uuname -l`:[`pwd`] "' To wring every drop of speed out of it, set an envariable called, say, $host to the value of `uuname -l` in your .login or .cshrc file. Then use $host in your $prompt. (This won't work if your super-user changes your hostname every few minutes.) To answer the original question about doing similar things in ksh, I can send default .profile and .kshrc files that do exactly that. My prompt contains the basename of the current directory and a reminder of the host I'm on. The actual basename program was too slow, so I use a ksh built-in to do it. The real work is done in one line: PS1="${host}_${PWD##*/}/ " This makes my prompts look like (when I'm in, say, /usr/spool/uucp): a_uucp/ bob desinger bd%hpsemc@hplabs.HP.COM uunet!hpda!hpsemc!bd