Directory Checking
Directory Listing
cd $LOG_DIR
if [ `pwd` != "$LOG_DIR" ] # or if [ "$PWD" != "$LOG_DIR" ]
# Not in /var/log?
then
echo "Can't change to $LOG_DIR."
exit $E_XCD
fi # Doublecheck if in right directory, before messing with log file.
Another way to do it,.
Another way to do it
E_XCD=66 # Can't change directory?
cd /var/log || {
echo "Cannot change to necessary directory." >&2
exit $E_XCD;
}