I have a script on my mac that displays the battery level with some color output. The color is based on the battery leve. As the level goes to zero, the color goes from green to red:
#!/bin/bash
percent=`ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%d", $10/$5 * 100)}'`
if [ $percent -gt 80 ] ; then
echo -n $'\e[32m'"${percent}%"
elif [ $percent -gt 65 ] ; then
echo -n $'\e[1;33m'"${precent}%"
elif [ $percent -gt 40 ] ; then
echo -n $'\e[1;31m'"${percent}%"
else
echo -n $'\e[31m'"${percent}%"
fi
I have put this in my tmux config as:
# status right options
set -g status-right '#[fg=green][#[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default] #($HOME/bin/battery)#[fg=green]]'
However, it shows up in my terminal as:
My question is, how can I get tmux to display the escape character correctly?