[OpenWrt-Devel] [PATCH] mac80211: remove error from detectscript

Stam, Michel [FINT] M.Stam at fugro.nl
Mon Oct 6 04:58:50 EDT 2014


Hello Jo,

I answered John, without realising that you described a similar use
case.

The for  loop as you describe should solve the problem as well.

Kind regards,

Michel Stam

-----Original Message-----
From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org] On
Behalf Of Jo-Philipp Wich
Sent: Friday, October 03, 2014 19:37 PM
To: openwrt-devel at lists.openwrt.org
Subject: Re: [OpenWrt-Devel] [PATCH] mac80211: remove error from
detectscript

Hi Michel, John.

>> -	for dev in $(ls /sys/class/ieee80211); do
>> +	for dev in $(ls /sys/class/ieee80211 2>/dev/null); do
> what error do you see ? if you see an error we should try to fix that 
> rather than supressing it

I suppose the case when "wifi detect" is invoked but no phy exists on
the system (e.g. because the radio hardware is not installed - think
USB).

In this case the entire /sys/class/ieee80211 is likely missing which
will cause "ls" to print a "No such file or directory" error.

Actually I do not really like that whole "for x in $(ls ...)" construct,
something like the following would save one fork and also not produce
errors:

for dev in /sys/class/ieee80211/*; do
    if [ -h "$dev" ]; then
         # do something with ${dev##*/}
    fi
done


~ Jow
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
_______________________________________________
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