Changing Your csh Prompt


Changing Your csh Prompt

Your system's default prompt might be just a dollar sign ($) or perhaps a dollar sign and date, or other information as outlined in the Setting Your csh Prompt Promptly sidebar. You can change this prompt using the following steps. You start by finding your prompt statement (Code Listing 8.21), then modifying it in your editor (Figure 8.7).

Figure 8.7. Edit your prompt to include the details you want.


To change your csh prompt:

1.

grep prompt ~/.cshrc ~/.login

To begin, list the configuration files located in your home directory and in the /etc directory. Look through your system configuration files for your prompt statement. It'll look something like set prompt="> " or set prompt="'hostname'> ". It's likely in your .cshrc file, as shown in Code Listing 8.21.

The Setting Your csh Prompt Promptly sidebar will help you translate this code.

2.

vi .cshrc

Use the editor of your choice to edit the configuration file with the prompt setting in it.

3.

set prompt="$LOGNAME > "

Set your prompt to something more suitable, as shown in Figure 8.7.

Code Listing 8.21. The prompt statement will likely be in your .cshrc file.

xmission> grep prompt ~/.cshrc ~/.login /home/users/e/ejray/.cshrc:if ($?USER == 0 || $?prompt == 0) exit /home/users/e/ejray/.cshrc:set prompt="'hostname'> " /home/users/e/ejray/.login: exit     # leave user at regular C shell prompt xmission> 

4.

Save the file and exit from the editor.

5.

su - yourid

Log in again to try it out (Code Listing 8.22).

Tip

  • Note the trailing space in the prompt code: set prompt="$LOGNAME > ". This extra space makes the prompt easier to use.


Setting Your csh Prompt Promptly

You can set your csh prompt to contain some types of information, but not as many as the bash or zsh prompts. The following list shows you what code to use to add certain kinds of information to your prompt (as well as help you translate the code in your existing prompt):

  • $LOGNAME shows the userid of the current userthat's you.

  • 'uname -n'% shows the host name of the computer


Code Listing 8.22. Test out your new prompt to see if you like it.

xmission> su - ejray Password: Sun Microsystems Inc.   SunOS 5.5.1Generic May 1996 You have mail. NOTE! As of 7/15/98, "tin" has been backed out its prior version.  NNTP     support was compiled in directly as well.  We hope that this will     stabilize its problems. ___________________________________________________________________    General questions email to "help" or "help@xmission.com".    Problems with the system mail to "support" or "support@xmission.com".    Type "acctstat" for a summary of your current account information.    Type "quota -v" to view your existing disk quota.    Type "help" for a list of online programs or "menu" for the assisted menu. ejray> 




Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net