> what does "sh -x" do exactly ?
assuming a shell script, using -x option it will be executed printing the expanded command in the script.
Looking at actual sample:
> /etc/wlan/shared: line 71: [: too many arguments
the execution on my system of 'sh -x /sbin/service wlan status' show the following output
>
> + /etc/init.d/wlan status
> /etc/wlan/shared: line 71: [: too many arguments
> wland is stopped
> + exit 3
from here you can see that something is going wrong in /etc/wlan/shared, looking further in it: 'sh -x /etc/wlan/shared' produce the following:
+ '[' '!' -n '' ']'
+ ECHO=echo
+ '[' -x /sbin/modprobe ']'
+ MODPROBE=/sbin/modprobe
+ '[' -x /sbin/wlanctl-ng ']'
+ WLANCTL=/sbin/wlanctl-ng
+ '[' -x /sbin/wland ']'
+ WLAND=/sbin/wland
++ cat /proc/sys/kernel/hotplug
============================================
+ '[' -f /proc/sys/kernel/hotplug -a -x -a -f /etc/hotplug/wlan.agent ']'
/etc/wlan/shared: line 71: [: too many arguments
============================================
+ HAS_HOTPLUG=n
+ '[' -f /etc/wlan/wlan.conf ']'
+ . /etc/wlan/wlan.conf
++ WLAN_DEVICES=wlan0
++ ChannelList=01:02:03:04:05:06:07:08:09:0a:0b:00:00:00
++ ChannelMinTime=200
++ ChannelMaxTime=250
++ WLAN_SCAN=n
++ SSID_wlan0=
++ ENABLE_wlan0=y
+ for i in '/etc/wlan/shared.*'
+ [[ '' == *~ ]]
+ [[ '' == *.rpmsave ]]
+ [[ '' == *.rpmold ]]
+ [[ '' == *.rpmorig ]]
+ [[ '' == *\#* ]]
+ . /etc/wlan/shared.prism2
++ PRISM2DL=/sbin/prism2dl
+ FIRMWARE_DIR=/etc/wlan/
looking at script (/etc/wlan/shared) you will find the following source:
if [ -f /proc/sys/kernel/hotplug -a \
-x `cat /proc/sys/kernel/hotplug` -a \
-f /etc/hotplug/wlan.agent ] ; then
HAS_HOTPLUG=y
else
HAS_HOTPLUG=n
fi
clearly the statement `cat /proc/sys/kernel/hotplug` is not producing any output, thus leading to an invalid test statement:
+ '[' -f /proc/sys/kernel/hotplug -a -x -a -f /etc/hotplug/wlan.agent ']'
/etc/wlan/shared: line 71: [: too many arguments
got it ?

AS