Quick question. How would I go about having a shell script to do the following:
- execute unix command (pmset -g ps) to check the output of that script every 5 seconds, and then if the output of that command falls to below say 40% (example of output is: 'Currenty drawing from 'AC Power' -iBox 100%; charging'), then for it to run a unix shell script...
Any help would be much appreciated.
Something like this would work
Edit, for Bash 2.05 and later:
Original, for Bash 3.2 and later: