expr non-numeric argument shell script
- by Kimi
The below check is not working : expr non-numeric argument shell script.
Always it is going to else. Please tell me what is the mistake.
Earlier I was no using while so the same thing was woring fine now suddenly when I did put it in the while loop it is no working.
echo "`${BOLD}` ***** Checking Memory Utilization User*****`${UNBOLD}`"
echo "==================================================="
IFS='|'
cat configMachineDetails.txt | grep -v "^#" | while read MachineType UserName MachineName
do
export MEMORY_USAGE1=`ssh -f -T ${UserName}@${MachineName} prstat -t -s rss 1 2 | tr '%' ' '| awk '$5>5.0'`
export LEN=`echo "$MEMORY_USAGE1"|wc -l`
export CNPROC=`echo "$MEMORY_USAGE1"|grep "NPROC"|wc -l`
export CTotal=`echo "$MEMORY_USAGE1"|grep "Total"|wc -l`
**if [ $LEN = `expr $CNPROC + $CTotal` ]
then
echo "`${BOLD}`**************All usages are normal !!!!!! *************`${UNBOLD}`"
else
echo "`${BOLD}`**** Memory(%) is more than 5% in MachineType $MachineType UserName $UserName
MachineName $MachineName *******`${UNBOLD}`"
echo "===================================================="
echo "$MEMORY_USAGE1"
fi**
done