I have a simple script. Do you know what I got this error?
./total_memory.ksh: line 5: [: missing `]'
Thanks
#! /bin/bash
setmem=30177660
totalMemory= grep MemTotal /proc/meminfo | awk '{print $2}'
if [$totalMemory -lt $setmem] ; then
echo "Total memory $totalMemory is less than :$setmem"
exit 1
else
echo "Total memory is :$totalMemory"
fi
Next in the comparison put a space between the brackets and the
expression. Also qualify your vairables "$totalMemory" so if it's not set
your script will not bomb.