<div dir="ltr"><div>Hi,<br><br></div>I have added following condition but its not working:<br><br>MYDEV='eth0'<br><br>if [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" ] && {<br>
  devstatus "$MYDEV" | grep '"up": true' && {<br>
    echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness<br>
  }<br>
}<br><br><div><div><div><div class="gmail_extra">fi <br><br></div><div class="gmail_extra">Am i doing any mistake or need to change anything<br><br></div><div class="gmail_extra">Regards,<br></div><div class="gmail_extra">John<br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_quote">On Tue, Sep 15, 2015 at 4:07 PM, Bastian Bittorf <span dir="ltr"><<a href="mailto:bittorf@bluebottle.com" target="_blank">bittorf@bluebottle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">* John kerry <<a href="mailto:kerry9842@gmail.com">kerry9842@gmail.com</a>> [15.09.2015 08:52]:<br>
<span class="">> I have to write some condition in<br>
> /etc/hotplug.d/button/50-wps/ file<br>
><br>
> I have to configure cat /etc/hotplug.d/button/00-wps file for following<br>
> condition:<br>
> if [ "$BUTTON" = "BTN_2" ] && [ "$ACTION" = "pressed" ]; then<br>
><br>
> I have to check eth0.1 if link is up then have ON status led otherwise OFF.<br>
<br>
</span>if i understand you correctly, you want this:<br>
<br>
MYDEV='eth0.1'<br>
[ "$BUTTON" = 'BTN_2' -a "$ACTION" = 'pressed' ] && {<br>
  devstatus "$MYDEV" | grep '"up": true' && {<br>
    your_action_here<br>
  }<br>
}<br>
<br>
but this is at least...rude. better you use the correct<br>
JSON-parser like:<br>
<br>
. /usr/share/libubox/jshn.sh<br>
json_load "$( devstatus eth0.1 )"<br>
json_get_var 'JSON_VAR_up' 'up'<br>
json_cleanup<br>
<br>
in case your dev is up you have e.g.<br>
$JSON_VAR_up = 1<br>
<br>
bye, bastian<br>
</blockquote></div><br></div></div></div></div></div>