Built-in String Processing?
Boyd Roberts
boyd at necisa.ho.necisa.oz
Tue Oct 30 10:00:18 AEST 1990
In article <1990Oct27.215051.14085 at midway.uchicago.edu>, phd_ivo at 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 at necisa.ho.necisa.oz.au
``When the going gets wierd, the weird turn pro...''
* V8/V9
More information about the Comp.unix.shell
mailing list