OK, this is weird.

I replaced the old batterylevel.sh file in extensions on the PW2 with the code eschwartz provided. Opened KUAL, selected "Show battery %" and nothing happens except the text "bin/batterylevel.sh" appears at the bottom of the screen. I don't get any kind of error message in the KUAL log.
I can't figure out what I'm doing wrong. If someone running 5.6.5 would try eschwartz's code, I'd appreciate any feedback you might have.