I would like to listen to the CPU usage, by getting each core percentage usage: CPUcore1 and CPUcore2 in a loop.
while : do if [ $CPUcore1 -gt 95 ] && [ $CPUcore2 -gt 95 ] then //script.. fi done CPUcore1 and CPUcore2 should be equal to what present on htop
In this example:
CPUcore1=70.0
CPUcore2=44.4
I know that some calculation should be made in order to evaluate this.

[ ... ], you have to escape>, or it is interpreted as redirection, creating a file95.[ $CPUcore1 > 95 ]is semantically identical totest $CPUcore > 95and> 95 test $CPUcore1andtest > 95 $CPUcore1and[ > 95 $CPUcore1 ]and[ $CPUcore1 ] > 95if [ "$CPUcore1" -gt 95 ] && [ "$CPUcore2" -gt 95 ]\>is not what you want, since that will do a lexical comparison rather than a numeric comparison.