topical media & game development
basic-shell-04-check-env.sh / sh
# Checks for environment variables.
# Uncomment the following line to remove the variable.
#unset DISPLAY
if [ "SHELL" == "" ]
then
echo "Using /bin/bash, which is the shell you should use."
SHELL=/bin/bash
fi
#unset USER
if [ "HOME" == "" ]
then
# Check for Mac OS X home.
if [ -d "/Users/USER"
# Check for Linux home.
elif [ -d "/home/USER"
else
echo -n "Please enter your home directory: "
read HOME
echo
fi
fi
# Display all the values.
echo "DISPLAY=SHELL"
echo "USER=HOME"
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.