- 论坛徽章:
- 0
|
Unix基础-学习笔记
S10 The Execution Environment
Concept: The exact behavior of commands issued in the shell depends upon the execution environment provided by the shell.
To view all the environment variables, use: printenv
To view a particular environment variable, use: echo $TERM
The creation of the execution environment.
When u log in, a sequence of events establishes the execution environment. It depends on the particular flavor of Unix, and also depends upon the default shell for your account.
For HP-UX operating system(other may differ):
The gritty process: it provides the login: prompt that u see on the terminal screen. It reads your username, and invokes login program.
The login program: trial and error verity to find your information in /etc/passwd, then to invoke your default shell. If doesn’t has default shell, login starts the Bourne shell (/bin/sh).
Shell startup: System login scripts
On HP-UX, the file /etc/.profile provides initialization parameters for ksh and sh, while the file /etc/csh.login is used for csh.
Shell startup: User login scripts
After the system login scripts are read, the shell reads user login scripts.
Important environment variables:
TERM,PATH,USER,HOME,MAIL,EDITOR,HOST
Setting environment and shell variables
The exact mechanism for it depends upon the type of shell u’re using.
sh, or ksh: VAR=value;export VAR
eg. EDITOR=emacs;export EDITOR (注意:中间不要空格)
csh: setenv VARIABLE value
eg. Setenv EDITOR emacs |
|