DALLASCAO.COM

Site of Cao Shouguang, English to Chinese translator

clean up dd-wrt nvram

#Clear ttraff (WAN bandwidth graph) nvram data
for i in `nvram show | grep traff- | cut -f1 -d=""`; do nvram unset $i; done
#clean up variable with no values
       rm /tmp/nvramshow
       nvram show >> /tmp/nvramshow
       i=0
       while read -r line; do
       val=${line#*=}
       var=${line%*=}
       if [[ "$val" == "" ]]; then
               nvram unset $var
       fi
       i=`expr $i + 1`
       if [[ $i == 50 ]]; then
               sleep 2
               i=0
       fi
       done < /tmp/nvramshow

Leave a Comment