Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
nightscout bash profile
RED="$(tput setaf 1 2>/dev/null || echo '')"
GREEN="$(tput setaf 2 2>/dev/null || echo '')"
YELLOW="$(tput setaf 3 2>/dev/null || echo '')"
NO_COLOR="$(tput sgr0 2>/dev/null || echo '')"
function __ps1_bgl {
eval "$(cat /mnt/c/Users/scott/.bgl-cache)"
local trend="?"
case "${nightscout_trend}" in
DoubleUp) trend="⇈";;
SingleUp) trend="↑";;
FortyFiveUp) trend="↗";;
Flat) trend="→";;
FortyFiveDown) trend="↘";;
SingleDown) trend="↓";;
DoubleDown) trend="⇊";;
esac
if [ "${nightscout_bgl}" -ge "${nightscout_target_top}" ]; then
printf "\001${YELLOW}\002"
elif [ "${nightscout_bgl}" -le "${nightscout_target_bottom}" ]; then
printf "\001${RED}\002"
else
printf "\001${GREEN}\002"
fi
printf "%03d %s" "${nightscout_bgl}" "${trend}"
printf "\001${NO_COLOR}\002"
}
export PS1="\$(__ps1_bgl) $ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.