|
|
Several of the variables reserved by the shell are used in your .profile. You can display the current value for any shell variable by entering the following command:
echo $variable_nameFour of the most basic of these variables are discussed next.
pwd
What was the system response? Now type:
echo $HOMEWas the system response the same as the response to pwd?
$HOME is the default argument for the cd command. If you do not specify a directory, cd will move you to $HOME.
LANG=de1[utsche]Ask your system administrator which languages are available on your computer, and what values you must assign to LANG to access them. Not all system commands support non-English usage. Check intro(1) for the ones that do. For details of LANG usage, see environ(5).
echo $PATHThe system will respond with your current PATH value.
$ echo $PATH :/mylogin/bin:/bin:/usr/bin $The colon ( ``:'' ) is a delimiter between pathnames in the string assigned to the $PATH variable. When nothing is specified before a ``:'', the current directory is understood. Notice how, in the last example, the system looks for commands in the current directory first, then in /mylogin/bin, then in /bin, and finally in /usr/bin.
If you are working on a project with several other people, you may want to set up a group bin, a directory of special shell programs used only by your project members. The path might be named /project1/bin. Edit your .profile, and add :/project1/bin to the end of your PATH, as in the next example.
PATH="$PATH:/project1/bin"
TERM=terminal_name export TERM tput initThe first two lines, together, are necessary to tell the computer what type of terminal you are using. The last line, containing the tput command, tells the terminal that the computer is expecting to communicate with the type of terminal specified in the TERM variable. Therefore, this command must always be entered after the variable has been exported.
If you do not want to specify the TERM variable each time you log in, add these three command lines to your .profile; they will be executed automatically whenever you log in.
If you log in on more than one type of terminal, it would also be useful to have your set.term command in your .profile.
Try the following example. Note that to use a multi-word prompt, you must enclose the phrase in quotes. Type the following variable assignment in your .profile.
PS1="Your command is my wish"Now execute your .profile (with the . command) and watch for your new prompt sign.
$ . .profile Your command is my wishThe ``$'' sign is gone forever, or at least until you delete the PS1 variable from your .profile.