Changing Your csh Path

Changing Your csh Path

The path statement tells the shell where to look for commands, scripts, and programs. So if you issue a command, the path statement tells the system to look for the command in the named directories in a specific order. As the following steps show, you change your csh path by first identifying where your path statement is located, then editing the file that contains it (Code Listing 8.19).

Code Listing 8.19. Use grep to find the path statement in your configuration files.

xmission> grep -i path ~/.cshrc ~/.login .cshrc:set path = (/usr/local/bin /usr/  local/bin/X11 /usr/openwin/bin  /usr/bin) xmission> 

To change your csh path:


grep -i path ~/.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 a path statement. As Code Listing 8.19 shows, it'll look something like set path = (/usr/local/bin /usr/local/bin/X11 /usr/openwin/bin /usr/bin). If you have more than one path statement, find the last one executed.


cp ~/.cshrc ~/.cshrc.backup

Make a copy of the file containing the path statement so that you can recover if you make mistakes. See Chapter 2 if you need more information on copying files.


vi .cshrc

Use the editor of your choice to edit the file with the path statement in it.


set path = (/usr/local/bin /usr/bin  /usr/ucb /usr/etc /home/users/e/  ejray/bin) 

Edit the path statement to add the full path to the bin subdirectory in your home directory, as shown in Figure 8.6.

Figure 8.6. Edit your path statement to add your home directory.


Save the file and exit from your editor. Refer to Chapter 4 for help if you need it.

Code Listing 8.20. Here's your new path statement!

xmission> echo $path /usr/local/bin:/usr/bin:>/usr/ucb:  /usr/etc:/home/users/e/ejray/in xmission> 


su - yourid

As you learned back in Chapter 3, this command starts a new login shell so you can test your changes before logging out.


echo $path

Display the current path environment variable. This should include the addition you just made. Lo and behold! There it is! (See Code Listing 8.20.)

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

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: