Problem with shell script using a variable from a unix command.
It is not putting the number only in $swap.
How can I get it to store the 4th number only from free -m |grep Swap? $swap=`free -m |grep Swap | awk {'print $4'}`; if($swap < 100){ print "swap low"; } Thanks in advance! |
Don't put the '$' in front of the variable name when you're assigning to it. For example, the following works on my PC:
Code:
SWAP=`free -m | grep Swap | awk {'print $4'}` |
All times are GMT -5. The time now is 12:54 PM. |