Thursday, July 24, 2014

Customizing the UNIX User Environment - Part 1 - UNIX shell configuration files - Part 1

Customizing the UNIX User Environment

**********************************************************************************

UNIX shell configuration files

**********************************************************************************

Introducing shell configuration files

---------------------------------------

 

A shell is an interactive interface that you use to communicate with the UNIX kernel. It provides a way of executing commands and getting standard feedback in the UNIX environment.

 

Kernel is a software layer that enables interaction of the HLL with the hardware

 

The most commonly used UNIX shells unclude the

- Bourne shell - is the oriinal UNIX shell, developed by Stephen Bourne. It doesnot support some of the features of the more recent shells, such as command-line editing

- Korn shell - is similar to the Bourne Shell but incorprates features from the C shell - dev by David Korn

- Bash shell - is the GNU (operating system) implementation of the Bourne shell, and stands for Bourne Again Shell. It adds features such as command-line editing to the original Bourne shell.

- C shell - is a UNIX shell developed by Bill Joy. It is similar to the Bourne shell, but its command set has been adapted syntactically to match the C language.

 

Typically a shell runs in interactive mode, meaning that you can type commands into it and get results. It's also possible to run a shell non interactively. For example, while working in the Bash shell you might need to run a shell script that required the C shell. If properly configured, the script could invoke the C shell in a noninteractive mode long enough to complete the script's running.

 

When a shell starts up, it reads several different configuration files to learn how you want it to look and behave. Typically, a shell will begin by reading the /etc/profile file. This file contains global environment variables that the root user wants constant for all users, and only root can edit this file.

 

Once the shell has processed the /etc/profile file, it reads the .profile file located in the home direcotry of the user that started the shell. The initial period indicates that the file is hidden.

 

Because UNIX generally only reads the .profile file during login, specific shells have additional startup and configuration files. Both the Korn and Bash shells have an evironment variable called ENV that points to a script that is run whenever a new shell is started, not just at login.The name of the file that ENV poins to is arbitrary. However, by convention, on Bash it is called .bashrc, and on Korn .kshrc.

No comments:

Post a Comment