pwd prompts in unix

Jeff Medcalf jkmedcal at uokmax.ecn.uoknor.edu
Tue Jun 25 00:05:12 AEST 1991


ketell at tolkien (Gregory Ketell) writes:

>CSH:
>	Create two aliases in your .cshrc file
>		alias cd	'cd \!*;promp'
>		alias promp	'set prompt = "`hostname`:`pwd` ! > "'
>	This will result in a prompt such as   tolkien:/usr/bin 23 > 
>	which tells you which machine you are currently on, your path, and
>	what history command you are on.

This could be done in a single alias:

	alias cd 'cd \!* ; set prompt = "`hostname`:`pwd` ! > "'

and then follow this with a cd . command (which would stay in the cwd but
set the prompt.

In tcsh, I use the following to shell commands in my .cshrc:

set prompt=%m\[%c\]\{%!\}\:
set prompt2=%m\[%c\]\{%!\}\?

%m is replaced by the machine name, %c is replaced by the last element of the
cwd, and %! is replaced by the history number.

-- 
Jeff Medcalf   jkmedcal at uokmax.{uucp|ecn.uoknor.edu}    !chinet!uokmax!jkmedcal
BoB smokes *my* pipe!            We carry in our hearts the true country...
In 1869, the waffle iron was invented, thus solving the annoying tendency of
waffles to wrinkle in the dryer.                        No new tale to tell.



More information about the Comp.unix.wizards mailing list