#!/bin/bash TEST='MD3000-battery' # sudo /opt/dell/mdstoragemanager/client/SMcli 204.90.40.43 -c "show storagearray batteryAge;" CMD='sudo /opt/dell/mdstoragemanager/client/SMcli' host1='tezpurmd1.hpc.lsu.edu' host2='tezpurmd2.hpc.lsu.edu' mdCMD='show storagearray batteryAge' output=$(${CMD} ${host1} -c "${mdCMD};" | grep --after-context=3 Battery) cnt=$( echo "${output}" | grep Optimal | wc -l) if [[ 'X2' == "X${cnt}" ]] then color='green' else color='red' fi $BB $BBDISP "$MACHINE.$TEST ${color} ${output}"