I am running the following command on the mac and I want to create a policy that would only run if the computer is plugged in
pmset -g ps | awk 'NR>1{exit};1'
This gives me the current power status and only the 1st line (don't want the battery info and percent)
Example I get this
Currently drawing from 'AC Power'
or
Currently drawing from 'Battery Power'
What I want is just the words AC Power or Battery Power
and then do an if statement
if Battery Power exit
if AC Power run update!
Can you guys give me a hand, my grep and awk skills suck,
Thanks guys