Fixed usage message and output improvements.

This commit is contained in:
Christoph Niethammer 2016-09-08 09:02:13 +00:00
parent d710e1f528
commit d2e6276d35

View file

@ -6,10 +6,8 @@
# #
function print_usage() { function print_usage() {
echo <<EOT echo "Script checking the module environment for problems during module loading/unloading"
Script checking the module environment for problems during module loading/unloading echo "usage: $0 [MODULE_PATTERN] [--exclude PATTERN]"
usage: $0 [MODULE_PATTERN] [--exclude PATTERN]"
EOT
} }
# Command line options: # Command line options:
@ -38,9 +36,8 @@ done
Color_Off='\e[0m' # Text Reset Color_Off='\e[0m' # Text Reset
IGreen='\e[0;92m' # Intense Green IGreen='\e[0;92m' # Intense Green
IRed='\e[0;91m' # Intense Red IRed='\e[0;91m' # Intense Red
IMagenta='\e[0;95m' # magenta
echo Moduleclasses: ${moduleclasses[@]}
echo Exclude: ${exclude_patterns[@]}
# intermediate files, logfiles # intermediate files, logfiles
LOGDIR=${LOGDIR:=$PWD} LOGDIR=${LOGDIR:=$PWD}
tmpdir=/tmp/check_modules-$USER tmpdir=/tmp/check_modules-$USER
@ -66,6 +63,9 @@ echo "Host: $(/bin/hostname)" | tee -a $logfile
echo "USER: $USER" | tee -a $logfile echo "USER: $USER" | tee -a $logfile
echo "Logfile: $logfile" | tee -a $logfile echo "Logfile: $logfile" | tee -a $logfile
echo "--------------------" | tee -a $logfile echo "--------------------" | tee -a $logfile
echo Moduleclasses: ${moduleclasses[@]} | tee -a $logfile
echo Exclude: ${exclude_patterns[@]} | tee -a $logfile
echo "--------------------" | tee -a $logfile
echo "Environment:" >> $logfile echo "Environment:" >> $logfile
cat $module_clean_env_file >> $logfile cat $module_clean_env_file >> $logfile
echo "--------------------" >> $logfile echo "--------------------" >> $logfile
@ -77,8 +77,9 @@ do
for exclude_pattern in ${exclude_patterns[@]} for exclude_pattern in ${exclude_patterns[@]}
do do
if [[ "$m_original" =~ "$exclude_pattern" ]]; then if [[ "$m_original" =~ "$exclude_pattern" ]]; then
echo MATCH: $exclude_pattern echo -e "Skipping $m_original (matches $exclude_pattern) ... ${IMagenta} skipped${Color_Off}"
match=1 match=1
continue
fi fi
done done
if [ $match == 1 ]; then if [ $match == 1 ]; then