Path: utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!uunet!munnari.oz.au!metro!cluster!necisa!boyd From: boyd@necisa.ho.necisa.oz (Boyd Roberts) Newsgroups: comp.unix.shell Subject: Re: Built-in String Processing? Message-ID: <1902@necisa.ho.necisa.oz> Date: 29 Oct 90 23:00:18 GMT References: <1990Oct27.215051.14085@midway.uchicago.edu> Organization: NEC Information Systems Australia Pty. Ltd. Lines: 36 In article <1990Oct27.215051.14085@midway.uchicago.edu>, phd_ivo@gsbacd.uchicago.edu writes: > ************* > I am running a csh with enhancements on my NeXT and on an HP-9000/8xx. > I have a macro to define my prompt to be the current directory, i.e. > > alias cd 'cd \!* && set prompt="\! ${cwd}> "' > > Unfortunately, this gives me a rather long string... > With a decent* shell you just go: cd() { builtin cd $1 && case "$1" in '') PS1="% " ;; ..|*/..) PS1="`basename \`/bin/pwd\``% " ;; /) PS1="/% " ;; */*) PS1="`basename $1`% " ;; *) PS1="$1% " ;; esac } Boyd Roberts boyd@necisa.ho.necisa.oz.au ``When the going gets wierd, the weird turn pro...'' * V8/V9