i makeI made this script to close a process, but iI can't compare a output awkthe awk result (var1var1) with a integeran Integer: var1 -gt 5000.
the problem is casting in bash?My script:
#!/bin/bash
var1= free -m |awk 'NR == 2'| awk '{print $3}'
var2= ps aux | grep '/opt/skype/skype' | grep -v grep | awk '{print $2}'
while true;
do
if [ $var1 -gt 5000 ]; then
echo "La memoria se ha excedido cerrando porcesos"
kill -9 $var2
break
else
echo "La memoria aun es estable $var1"
fi
done
thanksCould it be a casting problem in bash?