Modified shell script for taking granular readings