#!/bin/sh # Warn in red if data left <20% # Data usage in cyan if data left not <20% tx=$(gconftool -g /cellui/settings/datacounter/transfer/gprs_home_tx_bytes) rx=$(gconftool -g /cellui/settings/datacounter/transfer/gprs_home_rx_bytes) total=$(($tx+$rx)) usage=$(gconftool -g /cellui/settings/datacounter/general/gprs_home_notification_period_UI) totalMB=$((($tx+$rx)/1000000)) amount=`dc $total $usage / p` if [ $(echo "$amount > 0.800" |bc) -eq 1 ] then echo {{red}}"Data left < 20%" else echo {{cyan}}"Data used = $totalMB MB" fi exit 1