Maybe this line: current = ((bmestat | grep "battery current") | awk '{print $3}' ) is too complicated for someone like me, who knows very little about sh or python. But maybe split the job up into 3 smaller pieces would be easier: #!/bin/sh #Place the output of bmestat into string bmestring bmestring = bmestat #Extract the 'battery current' element out of the string in bmestring element = ($bmestring | grep "battery current") #Extract the numeric value out of element current = ($element | awk '{prit $3}') echo -n $current Now you can see my lack of knowledge. Maybe it would be easier in python. Can someone please help put me out of my misery with this? Thanks