Your account probably already has some helpful set up. You can add more from the command line or from your (like .cshrc or .profile). To see what environment variables are set, use the env (System V) or printenv (Berkeley) command. The command set should show shell variables (some of these might be repeated in the environment). Here's part of what happens on my account:
envHOME=/home/jpeek MH=/work/jpeek_mail/.mh_profile PATH=/home/jpeek/.bin:/home/jpeek/.bin/show:/work/bin:... RNINIT=/home/jpeek/.rnswitches PAGER=/usr/local/bin/less %
setactive /usr/lib/news/active cwd /home/jpeek/pwrtools mail (60 /usr/mail/jpeek) maillog /usr/spool/smail/log/logfile
UNIX programs use a lot of those environment variables.
For instance, my email system finds its setup file from MH.
But I can use environment variables for other things, too.
For instance, when I want to edit my email setup file, I can type
vi $MH from any directory.
The shell expands
$MH to /work/jpeek_mail/.mh_profile and starts
Check your environment and see what you've got; the names usually
explain the variables pretty well.
The shell uses shell variables like
 tells the C shell to pick the second word from the list in
I've set other shell variables for myself. When I send some mail messages, I want to watch the system mail log to see the message being delivered. I just type:
Are there files or directories that you refer to a lot - ones that aren't right for theor a shell alias? Pick a likely shell variable name and add the variable to your .cshrc or .profile. You can store more than one pathname in the same variable - either by separating them with spaces or by using wildcards:
# C shell variables: set worklog=~/todays_worklog Single file, defined when set set projfiles=(/work/beta/data_3.9*) Many files, defined when set set currdata='/work/beta/data_5*' Many files, defined when used # Bourne shell variables: worklog=$HOME/todays_worklog Single file, defined when set projfiles="`echo /work/beta/data_3.9_*`" Many files, defined when set currdata='/work/beta/data_5*' Many files, defined when used
You could type
vi + $worklog any time you want to add a note to the end
of the file todays_worklog in your home directory.
+ tells vi to start at the end of the file.)
The shell expands the asterisk (
*) when it sets the projfiles
variable and stores a list of the files as they were when the
variable was set.
(If the list of files changes, it'll be reset when you start your next shell.)
You could print all those files any time you wanted to by typing a
The C shell also lets you
from the list - for
lpr $projfiles would print the ninth file from the list.
When the currdata variable is set, the single quotes (
of the wildcard (
Instead, the pathname
/work/beta/data_5* is expanded when you use
the variable - like
pg $currdata - to show
you the files as they
are at the time you use the variable.
You can also use variables to store the paths to directories. Use cd, ls, or any other command with the variables.