Hi, I have added following condition but its not working:
MYDEV='eth0' if [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" ] && { devstatus "$MYDEV" | grep '"up": true' && { echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness } } fi Am i doing any mistake or need to change anything Regards, John On Tue, Sep 15, 2015 at 4:07 PM, Bastian Bittorf <bitt...@bluebottle.com> wrote: > * John kerry <kerry9...@gmail.com> [15.09.2015 08:52]: > > I have to write some condition in > > /etc/hotplug.d/button/50-wps/ file > > > > I have to configure cat /etc/hotplug.d/button/00-wps file for following > > condition: > > if [ "$BUTTON" = "BTN_2" ] && [ "$ACTION" = "pressed" ]; then > > > > I have to check eth0.1 if link is up then have ON status led otherwise > OFF. > > if i understand you correctly, you want this: > > MYDEV='eth0.1' > [ "$BUTTON" = 'BTN_2' -a "$ACTION" = 'pressed' ] && { > devstatus "$MYDEV" | grep '"up": true' && { > your_action_here > } > } > > but this is at least...rude. better you use the correct > JSON-parser like: > > . /usr/share/libubox/jshn.sh > json_load "$( devstatus eth0.1 )" > json_get_var 'JSON_VAR_up' 'up' > json_cleanup > > in case your dev is up you have e.g. > $JSON_VAR_up = 1 > > bye, bastian >
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel