* Comman Kang <kan...@163.com> [28.09.2015 17:37]: > Mostly done, except this one > > >+ hiwifi-hc5*61) > >+ __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = > >..:..:..:..:..:..'` > >+ lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr > >'[A-Z]' '[a-z]'` > > Is that really needed? > > >+ [ -n "$lan_mac" ] || lan_mac=$(cat > >/sys/class/net/eth0/address) > >+ wan_mac=$(macaddr_add "$lan_mac" 1) > >+ ;; > > > > That is needed, here is the result on my router. > > > root@Hiwifi:~# __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = > ..:..:..:..:..:..'` > root@Hiwifi:~# echo $__fac_mac > Vfac_mac = D4:EE:07:25:6C:D6 > root@Hiwifi:~# lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr > '[A-Z]' '[a-z]'` > root@Hiwifi:~# echo $lan_mac > d4:ee:07:25:6c:d6 > > > So that line is needed, __fac_mac itself is not a valid mac
can you please use this: set -- $( strings /dev/mtd7 | grep 'fac_mac = ..:..:..:..:..:..' ) lan_mac="$( echo $3 | tr '[A-Z]' '[a-z]' )" or maybe: for lan_mac in $( strings /dev/mtd7 | grep 'fac_mac = ..:..:..:..:..:..' ); do :; done lan_mac="$( echo $lan_mac | tr '[A-Z]' '[a-z]' )" maybe you can even use one of the helpers in /lib/functions/system.sh bye, bastian _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel