1. Environment Variables
-
operating system: type
echo $OSTYPE
show detail:USER: your login name HOME: the path name of your home directory HOST: the name of the computer you are using ARCH: the architecture of the computer processor DISPLAY: the name of the computer screen to display X windows PRINTER: the default printer to send print jobs PATH: the directory the shell should search to find a command
environment set:
type:setenv
environment show:
type:printenv
orenv
environment unset:
type:unsetenv
2. Shell Variables
-
echo history
: the vaule of how many shell commands to save -
cwd
: current working directory -
home
: the path name of your home directory -
path
: the directories the shell should search to find a command -
prompt
: the text string used to prompt for interactive commands shell
set or display shell variables:
type: set xxx
unset shell variables:
type: unset xxx
show all shell variables:
type: set | less
3. Using and setting variables
default file: ~/.login
(C shell) or ~/.cshrc
(TC shell)
~/.login
: set conditions which will apply to the whole session and to perform actions that are relevant only at login.
~/.cshrc
: set conditions and perform actions specific to the shell and to each invacation of it
recommand: set ENVIRONMENT variables in the .login
file , and SHELL variables in the .cshrc
file
warning: NEVER put commands that run graphical displays (e.g. a web browser) in your .cshrc or .login file
4. Setting shell variables in the .cshrc file
- edit
~/.cshrc
file:set history = 200
% source .cshrc
% echo $history
5. Setting the path
% set path = ($path ~/xxx/xx/bin)
- add this line to
.cshrc
file:set path = ($path ~/xxx/xx/bin)