A blank line before the unix prompt?

Wolf N. Paul wnp at dcs.UUCP
Mon Aug 8 23:03:20 AEST 1988


In article <3809 at okstate.UUCP> ash at a.cs.okstate.edu (Ashok Rathi) writes:
>
>Is it possible to make echo " " a part of the unix prompt? My objective
>is to print a blank line before a prompt to improve clarity of the output
>from the previous unix command. The example follows:

Your example suggests that you are using the C Shell (csh).

Here is a way to set your prompt appropriately, first for the C Shell:

  set prompt="\
  $USER:\!> "

This will generate a prompt that begins with a blank line (as you asked for)
and then prints the user's login name and the csh history number followed by
a "less-than" sign. Note that the newline which is to be part of the prompt
needs to be quoted with a backslash in the C Shell. All of this should go into
your .login file if you want it only in your login shell, or in .cshrc if
you want it in subshells as well.

Here is an example for the Bourne Shell, which needs to go into your .profile:

  PS1="
  $USER> " ; export PS1

This will generate a similar prompt to the above; if you do this on System V
Release 2 (and maybe earlier) substitute "$LOGNAME" for "$USER". Of course,
being Bourne Shell, it has no history number, and note that you do not have
to quote the newline. The "export" statement ensures that you will get this
same prompt in sub-shells, such as those spawned from within vi. If you have
the Korn Shell, use the Bourne example, but make that "$USER:!> " instead --
the Korn Shell has history, and does not want the exclamation point escaped.

Of course some people don't want their login name in their prompt, but instead
the current directory -- this has been discussed endlessly a few months ago,
and I am not going to re-start this discussion.
-- 
Wolf N. Paul * 3387 Sam Rayburn Run * Carrollton TX 75007 * (214) 306-9101
UUCP:     killer!dcs!wnp                 ESL: 62832882
DOMAIN:   wnp%dcs at killer.dallas.tx.us    TLX: 910-380-0585 EES PLANO UD



More information about the Comp.unix.questions mailing list