jeudi 2 juin 2016

If [commands -gt value] is acceptable?

Helo, im newbie on Linux and Scripting, i want to make Loop command which will disable my CPU if its running at low Usage, first i try to make simple command like this

A=[ $top -bn1 | grep CPU |head -1 |sed s/"%"/""/g|awk '{print $8}' ]

B="2"

if [ $A -gt $B ] then echo a else echo b fi

But is says Not Found and Unexpexted.

Any information is highly appreciable.

Thank You.

Aucun commentaire:

Enregistrer un commentaire