Code:
#!/bin/bash

cd "${0%/*}"

# poll battery every x seconds
resolution=5

clear
echo
read -p "Be sure screen and computer sleep are disabled, press RETURN: " x
clear
echo
echo "Recommended steps for use:"
echo "1) disable energysaver settings that will put the computer to sleep"
echo "2) wait for the battery to become fully charged, or as far as it will go"
echo "3) start battmonitor"
echo "4) immediately unplug ac power"
echo "5) allow the computer to deplete the battery and go to forced sleep"
echo "6) plug the computer back into ac power and immediately wake it up"
echo "7) allow the computer to fully charge the battery"
echo "8) ctrl-c to stop battmonitor, and run battsummary to view resuls"
echo
echo

if [ -f battcheck.txt ] ; then
  echo "battcheck.txt file already exists."
  echo
  echo "If the computer shut down instead of sleep, you can resume"
  echo "the recording now to analyze the charge process as well."
  echo "This is best done immediately after ac power was restored."
  echo
  while true ; do
    read -p "Resume recording or Create new? (R/C): " rc
    rc=$(echo "$rc" | tr a-z A-Z)
    if [ "$rc" == "C" ] ; then
      rm battcheck.txt
      echo
      echo "(old recording file has been cleared)"
      break
    elif [ "$rc" == "R" ] ; then
      echo
      echo "(resuming recording)"
      break
    fi
  done
fi

echo
echo
echo "monitoring battery...  use battsummary to view results later."
echo
while true ; do
  x=$(system_profiler SPPowerDataType | grep -i remaining)
  y=$(date)
  echo "$y $x"
  echo "$y $x" >> battcheck.txt
  sleep $resolution
done


I work for the Department of Redundancy Department