[OpenWrt-Devel] [PATCH v4] brcm-wl: fix bash comparison error

Felix Fietkau nbd at openwrt.org
Sat Oct 18 15:31:49 EDT 2014


On 2014-10-18 13:55, Álvaro Fernández Rojas wrote:
> wlc returns a string number ending with "\n", making it impossible to compare this value to a number.
> 
> Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
> ---
> v4: remove bashishm as suggested by Bastian Bittorf.
> v3: avoid using an extra variable.
> v2: use string comparison
> 
> diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
> index 69e3132..5994e26 100644
> --- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
> +++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
> @@ -209,7 +209,7 @@ enable_broadcom() {
>  	}
>  
>  	local leddc=$(wlc ifname "$device" leddc)
> -	[ "$leddc" -eq 0xffff ] || {
> +	[ "$leddc" = '0xffff\n' ] || {
I don't like this comparison against a fixed string with \n.
I'd prefer something like: [ "$(($leddc))" -eq "$((0xffff))" ]

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list