pwd prompts in unix

Luke Mewburn s902113 at minyos.xx.rmit.oz.au
Mon Jun 24 11:43:52 AEST 1991


ketell at tolkien (Gregory Ketell) writes:

>How you set up your prompt depends on what shell you are running.  Here are
>some methods I use.

>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.

Doing the following will give you the path as an index to your home (if
it can), so instead of:
   minyos [/u1/s90/s902113/bin] 58:
we get
   minyos [~s902113/bin] 58:
Also, support for pushd & popd is provided...
(NB: I didn't write the set_prompt [well, the 'sed' bit anyway], I just
 reconfigured it for my preferences of hostname & history index placing)

  alias set_prompt 'set prompt="$host"" [`dirs|sed -e '\''s| .*||'\''`] \\!: "'
  alias cd 'cd \!*; set_prompt'
  alias push 'pushd \!*; set_prompt'
  alias pop 'popd; set_prompt'

>KSH:
>	The Korn Shell has support for that built in.  All you do is set
>	your prompt command in your .profile to something like
>		PS1  $HOST:$PWD ! >
>		export PS1
>	and it will give you the same results as above.  
>	(Please excuse me if this is not perfect.  I have not been on
>	 the Korn Shell for quite some time.)

>Good Luck,
>Gregory G. Ketell
>Director of Systems Engineering
>Rimma Technologies, Inc. 
>gketell at seq.csuhayward.edu



More information about the Comp.unix.wizards mailing list