Quick Start Guide
To set a local variable, use a variable name followed by the equal sign, followed by
the value:
PROJECT="SLED"
Do not insert spaces around the equal sign, otherwise you get an error. To set an
environment variable, use export:
export NAME="tux"
To remove a variable, use unset:
unset NAME
The following table contains some common environment variables which can be used
in you shell scripts:
Table 18.5: Useful Environment Variables
the home directory of the current user
HOME
the current host name
HOST
when a tool is localized, it uses the lan-
guage from this environment variable.
English can also be set to C
LANG
the search path of the shell, a list of di-
rectories separated by colon
PATH
species the normal prompt printed
before each command
PS1
species the secondary prompt printed
when you execute a multi-line com-
mand
PS2
current working directory
PWD
the current user
USER
18.5.1 Using Argument Variables
For example, if you have the script foo.sh you can execute it like this:
foo.sh "Tux Penguin" 2000
Bash and Bash Scripts 233










