On 2014-10-18 22:37, Bastian Bittorf wrote: > * Nathan Hintz <nlhi...@hotmail.com> [18.10.2014 22:24]: >> Using the "\n" is not correct. I think the real problem is that the logic >> is reversed (should be && instead of ||); although it might >> be better to eliminate the conditional entirely since leddc is always >> commanded to "0xffff" when the interface is taken down. >> >> local leddc=$(wlc ifname "$device" leddc) >> [ "$leddc" = "0xffff" ] && { >> leddc=0x005a000a >> } > > what about: > > case "$leddc" in > '0xffff'*) > leddc='0x005a000a' > ;; > esac > > IMHO the approach from felix does not work: > root@box:~ echo $((0xffff)) > 65535 > root@box:~ echo $((0xffff\n)) > -ash: arithmetic syntax error Your testcase is wrong: \n does not get substituted for a newline here. If you test with a script that outputs an extra newline, using $(()) works.
- Felix _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel