Week 10: Shell Environments / Programming / Makefiles Flashcards
The shell environment consists of a set of _____ with _____
Variables with values
Shell variables are used by putting _ in front of their names
$ in front of their names:
$HOME
The two kinds of shell variables are:
Environment variables: available in the current shell and the programs invoked by the shell
Regular shell variables: not available by programs invoked in this shell
In bash, REGULAR variables are defined by:
varname=varvalue
In bash, environment variables are called
“exported variables”
Environment variables are defined by:
MYENVVAR=”env var”
export MYENVVAR
or
export MYENVVAR=”env var”
To clear an environment variable, simply use…
unset
ex: unset varname;
In csh and tcsh to create REGULAR variables, use…
To delete them….
set
ex: set VARNAME=”var”
unset
ex: unset VARNAME
In csh and tcsh to create environment variables, use
setenv WITH NO EQUALS SIGN
ex: setenv VARNAME “var”
unsetenv
ex: unsetenv VARNAME
What do the following shell variables mean:
SHELL
PATH
LANG
USER
HOME
TERM
DISPLAY
HOSTNAME
SHELL: the name of the shell being used
PATH: where to find executables to execute
LANG: the locale you are using
USER: the user name of the user logged in
HOME: the user’s home directory
TERM: the kind of terminal the user is using
DISPLAY: where X program windows are shown
HOSTNAME: the name of the host logged on to
In UNIX, single quotes do what
Stop the expansion of a variable:
echo “Welcome $HOME”
Welcome /home/Connor
echo ‘Welcome $HOME’
Welcome $HOME
In UNIX, backwards quotes do what
Replace the variable with what is returned from the execution of the command
Unix automatically searches for executables in…
Whatever is specified by the variable PATH
In Unix, do executables automatically execute from the current durectory?
NO
use: ./ to specify the current directory using the .
If there are multiple versions of a command, Unix executes them in the order of …
Left to right