Shells, Shell Scripting, and The UNIX File System
Shells, Shell Scripting, and The UNIX File System
and the
UNIX File System
CMSC 121 Introduction to UNIX
Setting up an alias:
The exact syntax depends on the shell that you are using. We will
cover how to do it under tcsh and bash. Most other shells use a
similar or identical syntax.
tcsh syntax:
alias <aliased name> <original command>
bash syntax:
alias <aliased name>=<original command>
Environment Variables
Think of the shell as any other program that
you write. Your program maintains information
about its current state. Since the shell's main job
is to act as a liaison between the kernel and the
user, it maintains information about the
computing environment. The environment
variables hold this information.
Viewing Your Environment Variables
Most UNIX systems provide a command env that will allow you to see all of these variables that the shell is
maintaining.
Here is an example of the env command issued on one of the linix.gl servers using the tcsh shell:
HOME=/afs/umbc.edu/users/j/o/josey1/home
USER=josey1
LOGNAME=josey1
PATH=.:/afs/umbc.edu/users/j/o/josey1/home/bin:/usr/local/bin:/usr/bsd:/bin
:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/X11:/etc:/usr/etc:/usr/k5/bi
n:/usr/afsws/bin:/bin:/usr/java/bin:/usr/afsws/bin:/usr/X11R6/bin
MAIL=/afs/umbc.edu/users/j/o/josey1/Mail/inbox
SHELL=/bin/tcsh
TERM=xterm
DISPLAY=linux2.gl.umbc.edu:10.0
KRB5CCNAME=FILE:/tmp/krb5cc_l29893
HOSTTYPE=i386-linux
VENDOR=intel
OSTYPE=linux
MACHTYPE=i386
SHLVL=1
PWD=/afs/umbc.edu/users/j/o/josey1/home
GROUP=general
HOST=linux2.gl.umbc.edu
HOSTNAME=linux2.gl.umbc.edu
LESSOPEN=|/usr/bin/lesspipe.sh %s
TZ=EST5EDT
MANPATH=/usr/X11R6/man:/usr/k5/man:/usr/local/man:/usr/man:/usr/share/man
EDITOR=/usr/local/bin/pico
Important Environment Variables
HOME - your home directory.
USER and LOGNAME - your login ID.
HOSTNAME - the name of the host computer.
PWD - the current working directory.
MAIL - where your mail is located.
PATH - a list of directories in which to look for executable
commands.
# print my quota
echo "\n--- My Disk Quota ---“
quota –v
echo "“