troubleshooting bash script.  having problems with getting all the errors to log, but have made some progress and cleaned some stuff up.