Hey if you're still looking for something (although it's been a while, but I'm gonna post just in case) I found a command
Code:
acpi -b | egrep -o "[0-9]+%"
will return the same thing as $battery_percent, but with a percent sign, so you can use that and pass it to your shell script, just make sure you take care of the extra symbol.