A blank line before the unix prompt?

Michael Greim greim at sbsvax.UUCP
Thu Aug 11 19:34:50 AEST 1988


In article <1236 at ficc.UUCP>, spenser at ficc.UUCP (spenser aden) writes:
... stuff deleted ...
> This is interesting, and I would like to do something similar on my XENIX 386
> machine, but I've got a problem.  I'd like to display the current directory
> on the firrst line, and the csh history counter on the second line at the 
> prompt.  Something like :
> 
> /usr2/spenser/bin
> (15) _
> 
> In order to do this, I have to alias 'cd'.  I've tried this (and a few 
> derivations of) in my .cshrc :  
> 
> alias cd 'cd \!* ; set prompt="[=5h"`pwd`"[=5l \
> (\!) " '    # set prompt string
> 
> (If this is hard to read, I have "<esc>[=5h" and "<esc>[=5l" around the `pwd`)
> And I have this 'set prompt' command by itself in my .login.  The escape
> sequence simply places the directory name in half intensity.  This works fine
> when I first login and until I try to 'cd' to any directory, but when I try
> to 'cd' it says 'Unmatched "."' and the 'cd' fails.  I suspect that it's not 
> able to carry the alias over to the second line using the \ method spelled 
> out in the previous article, but how does one get an alias definition of this
> sort to span two lines?  Sorry, I've tried to RTFM, but I can't find 'alias' in
> the reference manual my company has provided me.

My prompt looks like this: (the things between the dotted lines)
-------

sbsvax::/RW/usr/greim/NEWS 
(3) % 
-------
Note the blank line.
In my .login there is:

set prompt="\
`/bin/hostname`::$cwd \
(\!) % "

In my .cshrc there is :

set my_host=`/bin/hostname`
alias cd 'cd \!*; set prompt="\\
${my_host}::$cwd \\
(\\!) % "'
alias pushd 'pushd \!*; set prompt="\\
${my_host}::$cwd \\
(\\!) % "'
alias popd 'popd \!*; set prompt="\\
${my_host}::$cwd \\
(\\!) % "'
set prompt="\
${my_host}::$cwd \
(\!) % "

You need to set the prompt in .cshrc in case you are calling script or
any other program which resets the value of prompt and then calls csh.

	Absorb, apply and enjoy,
		-mg
-- 
+------------------------------------------------------------------------------+
| UUCP:  ...!uunet!unido!sbsvax!greim   | Michael T. Greim                     |
|        or greim at sbsvax.UUCP           | Universitaet des Saarlandes          |
| CSNET: greim%sbsvax.uucp at Germany.CSnet| FB 10 - Informatik (Dept. of CS)     |
| ARPA:  greim%sbsvax.uucp at uunet.UU.NET | Bau 36, Im Stadtwald 15              |
| Phone: +49 681 302 2434               | D-6600 Saarbruecken 11, West Germany |
+------------------------------------------------------------------------------+
| # include <disclaimers/std.h>                                                |
+------------------------------------------------------------------------------+



More information about the Comp.unix.questions mailing list