Optimize the tool checkEnvironment.sh