1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/bin/bash thresh=$1 shift while true; do num=`acpi -t|sed -nr 's/.*, ([0-9.]*) .*/\1/p` num=${num:-0} if (( "$num" > "$thresh" )); then eval "$*" else sleep 1 fi done