This is my attempt to make a script that will use a mouse move to prevent screen blanking while watching videos. I'm hoping to use the value for highest CPU% process in top and if CPU usage exceeds 5%, a mouse move should occur.#!/usr/bin/env bashsleep_period=60s while true; do  if (( $(top -bn 1 | sed -nrs '8p' | awk '{ print $9 }') -gt 5 )); then     while (( $(top -bn 1 | sed -nrs '8p' | awk '{ print $9 }') -gt 5 )); do      xdotool mousemove 0 100      xdotool mousemove 0 50      sleep ${sleep_period}    done  else    sleep ${sleep_period}  fidoneUnfortunately, it does not work. The errors are like this:[07:20 PM] /bin $ noo.sh/home/vasa1/bin/noo.sh: line 6: ((: 0.0 -gt 5 : syntax error: invalid arithmetic operator (error token is .0 -gt 5 )/home/vasa1/bin/noo.sh: line 6: ((: 6.4 -gt 5 : syntax error: invalid arithmetic operator (error token is .4 -gt 5 )How do I fix this? (Please note that I'm not experienced in scripting.)  Based on answers here, I put together:#!/usr/bin/env bashsleep_period=5m while true; do  if [[ $(top -bn 1 | sed -nrs '8p' | awk '{ print int($9) }') -gt 8 ]]; then     while [[ $(top -bn 1 | sed -nrs '8p' | awk '{ print int($9) }') -gt 8 ]]; do      xset -dpms; xset s off      xset +dpms; xset s on      sleep ${sleep_period}    done  else    sleep ${sleep_period}  fidoneThen, I reported this code over at Ubuntu Forums and Vaphell worked on it further. Below is Vaphell's version and is what I am using:#!/usr/bin/env bashsleep_period=5m while true; do  if top -bn 1 | awk 'NR==8 { exit !($9>8); }'; then    xset -dpms; xset s off    xset +dpms; xset s on  fi  sleep ${sleep_period}done
Script to prevent screen blanking using mouse move doesn't work
bash script
You have a couple of issues, first, you will need 2 iterations of top each time, see my answer here and the bug report here.The other problem is that bash does not do floating point, so if your CPU usage is something like 6.2, the .2 will break the script. Bash is simply not designed for 'complex' arithmetic operations.  One way around this would be to move the >5 check inside your awk command:#!/usr/bin/env bashsleep_period=60s while true; do    until top -bn 2 -d 0.01 | sed -nrs '8p' | awk '{if($9>5){exit 1}else{exit 0}}'; do      xdotool mousemove 0 100      xdotool mousemove 0 50      sleep ${sleep_period}    done   sleep ${sleep_period}done