why is there no prog help sticky?
i guess this question will become a noob scripting help general so i won't feel bad for mucking up this board.
i'm trying to crate a script for my zsh prompt to display my laptop's battery in different colors depending on how full it is.
I need to isolate the percentage without the '%' and sometimes a ',' to do the math.
[CODE]
#!/bin/bash
ACPI=$(acpi)
BATTERY=$(echo $ACPI | gawk '{ print $4 }')
STATE=$(echo $ACPI | gawk '{ print $3 }')
STATE=${STATE:0:1}
if [[ ${BATTERY:${#BATTERY}} -ne '\%' ]]
then
echo "hello"
fi
if [[ $STATE -eq "U" ]]
then
STATE=F
fi
echo $STATE:$BATTERY
#${BATTERY:0:${#BATTERY}-2}
[/CODE]