[comp.unix.ultrix] Pretty prompt

rfrost@umiami.ir.miami.edu (06/14/91)

How do I get a prompt which will always show the current directory.
For example:

     /usr/rfrost>

mckay@mace.cc.purdue.edu (Dwight D. Mckay) (06/14/91)

In article <1991Jun13.163726.10604@umiami.ir.miami.edu>, rfrost@umiami.ir.miami.edu writes:
|> How do I get a prompt which will always show the current directory.
|> For example:
|> 
|>      /usr/rfrost>

Under csh you could put the following in your .cshrc:

alias cd cd \!$ \; set prompt=\"\`echo \$cwd \| sed \'s\?${home}\?\~\?\'\`\>\ \"

This puts your current path in your prompt, substitution "~" for your home directory whenever you type "cd".

--ddm

shah@santur.tay1.dec.com (Amitabh Shah) (06/15/91)

In article <13562@mentor.cc.purdue.edu>, mckay@mace (Dwight D. Mckay) writes:
>In article <1991Jun13.163726.10604@umiami.ir.miami.edu>, rfrost@umiami.ir.miami.edu writes:
>|> How do I get a prompt which will always show the current directory.
>|> For example:
>|> 
>|>      /usr/rfrost>
>
>Under csh you could put the following in your .cshrc:
>
>alias cd cd \!$ \; set prompt=\"\`echo \$cwd \| sed \'s\?${home}\?\~\?\'\`\>\ \"
>
>This puts your current path in your prompt, substitution "~" for your home directory whenever you type "cd".
>

Or better yet, get the latest version of tcsh, and use:

set prompt="%~> "

in your .login. You can do many other things with tcsh too!

-amitabh.
_______________________________________________________________________________
Amitabh Shah                               shah@santur.tay1.dec.com--(INTERNET)
Digital Equipment Corporation		   {..}!decwrl!santur.tay1!shah--(UUCP)
TP Systems Performance			   +1 508 952 4430--------------(PHONE)
151 Taylor St. Littleton MA 01460	   +1 508 952 4197----------------(FAX)

yzarn@lhdsy1.chevron.com (Philip Yzarn de Louraille) (06/16/91)

In article <1991Jun13.163726.10604@umiami.ir.miami.edu> rfrost@umiami.ir.miami.edu writes:
>How do I get a prompt which will always show the current directory.
>For example:
>
>     /usr/rfrost>

On Ultrix, and using the csh, I use:

set prompt="`echo $cwd`>"
alias cd      cd \!\* \; set prompt='"`echo $cwd`>"'
alias pushd   pushd \!\* \; set prompt='"`echo $cwd`>"'
alias popd    popd \!\* \; set prompt='"`echo $cwd`>"'
You could replace echo $cwd by pwd, but it is slower and won't always
show you what you want, especially if you have directories that have
symbolic links to somewhere else.
-- 
  Philip Yzarn de Louraille                 Internet: yzarn@chevron.com
  Research Support Division                 Unix & Open Systems
  Chevron Information & Technology Co.      Tel: (213) 694-9232
  P.O. Box 446, La Habra, CA 90633-0446     Fax: (213) 694-7709

lutmann@geocub.UUCP (Patrice LUTMANN) (06/17/91)

In article <962@lhdsy1.chevron.com> yzarn@lhdsy1.chevron.com (Philip Yzarn de Louraille) writes:
>In article <1991Jun13.163726.10604@umiami.ir.miami.edu> rfrost@umiami.ir.miami.edu writes:
>>How do I get a prompt which will always show the current directory.
>>     /usr/rfrost>
>set prompt="`echo $cwd`>"
>alias cd      cd \!\* \; set prompt='"`echo $cwd`>"'
>alias pushd   pushd \!\* \; set prompt='"`echo $cwd`>"'
>alias popd    popd \!\* \; set prompt='"`echo $cwd`>"'

    Why not just:
	alias cd    cd    \!* \; set prompt='"$cwd>"'
	alias pushd pushd \!* \; set prompt='"$cwd>"'
	alias popd  popd  \!* \; set prompt='"$cwd>"'

					[Pat]

smw@trm.concordia.ca ( Steven Winikoff ) (06/17/91)

In <5270@ryn.mro4.dec.com> shah@santur.tay1.dec.com (Amitabh Shah) writes:
                                            ^^^^

>Or better yet, get the latest version of tcsh, and use:

>set prompt="%~> "

>in your .login. You can do many other things with tcsh too!

>-amitabh.
>_______________________________________________________________________________
>Amitabh Shah                               shah@santur.tay1.dec.com--(INTERNET)
>Digital Equipment Corporation		   {..}!decwrl!santur.tay1!shah--(UUCP)
>TP Systems Performance			   +1 508 952 4430--------------(PHONE)
>151 Taylor St. Littleton MA 01460	   +1 508 952 4197----------------(FAX)


Don't tell me...   There are people at DEC who like tcsh???

I must be hallucinating!  Obviously this can't possibly be true.

Okay, I admit I'm being sarcastic.  However, the aforementioned "conclusion"
follows from the fact that vipw on Ultrix 4.1 has /bin/sh and /bin/csh coded
directly into it, leading one to believe that DEC also hates the Korn shell
(which is interesting, since this one is supplied with the system!).

What's going on, guys?  Will we ever return from the dark ages and simply
accept whatever happens to be in /etc/shells?  Isn't that what /etc/shells
is *for*????

I *like* tcsh myself.  Why can't I choose to use it as root on my single-user
workstation without having to write my own vipw?

I'm not a very happy camper on this issue.

- Steven

------------------------------------------------------------------------
Steven Winikoff                                 smw@alcor.concordia.ca
Software Analyst
Dept. of Computing Services
Concordia University                            voice: (514) 848-7619
Montreal, Quebec, Canada                               (10:00-18:00 EST)  

gerhard@mognet.aui.dec.com (Gerhard Aschauer) (06/18/91)

In <3241@trm.concordia.ca>  Steven Winikoff  writes:

>Don't tell me...   There are people at DEC who like tcsh???

Yes, there are! (me for instance).
Besides, I'm not sure for older version of Ultrix but in V4.2 you simply
put tcsh in /etc/shells and
it'll work!

Ciao,
/ga





Gerhard Aschauer			"I speak for myself!"
Digital Equipment Corporation
TSSC/CSC Vienna
-----------------------------

shah@santur.tay1.dec.com (Amitabh Shah) (06/18/91)

In article <smw.677170437@trm>, smw@trm ( Steven Winikoff ) writes:
>
>Don't tell me...   There are people at DEC who like tcsh???
>
>I must be hallucinating!  Obviously this can't possibly be true.
>
>Okay, I admit I'm being sarcastic.  However, the aforementioned "conclusion"
>follows from the fact that vipw on Ultrix 4.1 has /bin/sh and /bin/csh coded
>directly into it, leading one to believe that DEC also hates the Korn shell
>(which is interesting, since this one is supplied with the system!).
>
>What's going on, guys?  Will we ever return from the dark ages and simply
>accept whatever happens to be in /etc/shells?  Isn't that what /etc/shells
>is *for*????
>
>I *like* tcsh myself.  Why can't I choose to use it as root on my single-user
>workstation without having to write my own vipw?
>

FWIW, /etc/shells on my machine (running Ultrix 4.1) looks like:

/bin/sh
/bin/csh
/usr/bin/ksh
/usr/bin/sh5
/usr/local/bin/tcsh

The first four came with the system, I added the fifth later.

I have been using tcsh for both, my personal account and the root account. I
changed both of these using chsh after modifying /etc/shells.

Yes, some people at DEC do like tcsh!

-amitabh
_______________________________________________________________________________
Amitabh Shah                               shah@santur.tay1.dec.com--(INTERNET)
Digital Equipment Corporation		   {..}!decwrl!santur.tay1!shah--(UUCP)
TP Systems Performance			   +1 508 952 4430--------------(PHONE)
151 Taylor St. Littleton MA 01460	   +1 508 952 4197----------------(FAX)

shari@zahle.wpi.edu (Shari Deiana VanderSpek) (06/26/91)

In article <1991Jun13.163726.10604@umiami.ir.miami.edu> rfrost@umiami.ir.miami.edu writes:
>How do I get a prompt which will always show the current directory.
>For example:
>
>     /usr/rfrost>


i put 2 lines in my .cshrc to do this

set prompt="`echo $cwd`> "
alias cd 'cd \!*;set prompt="`echo $cwd`> "'