#!/bin/bash -l for m in $(module av 2>&1); do if [[ $m =~ ^[A-Za-z] ]]; then module load $m >.module_load.log 2>&1 if ! module li 2>&1 | grep $m >/dev/null; then echo "ERROR: Module $m failed to load" fi if grep -i "error" ".module_load.log" >/dev/null; then echo "ERROR: Module $m reported errors when loading:" awk '{print " " $0;}' .module_load.log fi module purge 2>/dev/null fi done