start page | rating of books | rating of authors | reviews | copyrights

Learning the Korn Shell

Learning the Korn ShellSearch this book
Previous: 3.5 Customization and SubprocessesChapter 3
Customizing Your Environment
Next: 4. Basic Shell Programming
 

3.6 Customization Hints

You should feel free to try any of the techniques presented in this chapter. The best strategy is to test something out by typing it into the shell during your login session; then if you decide you want to make it a permanent part of your environment, add it to your .profile.

A nice, painless way to add to your .profile without going into a text editor makes use of the print command and one of the Korn shell's editing modes. If you type a customization command in and later decide to add it to your .profile, you can recall it via [CTRL-P] or [CTRL-R] (in emacs-mode) or j, -, or ? (vi-mode). Let's say the line is:

PS1="($LOGNAME !)->"

After you recall it, edit it so that it is preceded by a print command, surrounded by single quotes, and followed by an I/O redirector that (as you will see in Chapter 7) appends the output to ~/.profile:

$ print 'PS1="($LOGNAME !)->"' >> ~/.profile

Remember that the single quotes are important because they prevent the shell from trying to interpret things like dollar signs, double quotes, and exclamation points.

You should also feel free to snoop around other peoples' .profiles for customization ideas. A quick way to examine everyone's .profile is as follows: let's assume that all login directories are under /home. Then you can type:

$ cat /home/*/.profile > ~/other_profiles

and examine other people's .profiles with a text editor at your leisure (assuming you have read permission on them). If other users have environment files, the file you just created will show what they are, and you can examine them as well.


Previous: 3.5 Customization and SubprocessesLearning the Korn ShellNext: 4. Basic Shell Programming
3.5 Customization and SubprocessesBook Index4. Basic Shell Programming

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System