title: Check wireless device is up
body: <p>I would like to check if my wireless device is correctly up.</p>
  
  <p>In order to do this, I execute the following command : </p>
  
  <pre><code>ip link show wlan0
  </code></pre>
  
  <p>I obtain : </p>
  
  <pre><code>6: wlan0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP mode DEFAULT     group default qlen 1000
     link/ether fc:c2:de:2d:f4:c2 brd ff:ff:ff:ff:ff:ff
  </code></pre>
  
  <p>when the interface is up and </p>
  
  <pre><code>6: wlan0: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc mq state DOWN mode DEFAULT group     default qlen 1000
      link/ether fc:c2:de:2d:f4:c2 brd ff:ff:ff:ff:ff:ff
  </code></pre>
  
  <p>when it is down. </p>
  
  <p>Now, I would like to test if UP is present or not at the command line return. </p>
  
  <p>I tried the following command : </p>
  
  <pre><code> ip link show mlan0 | awk '/UP/ {print $3}'
  </code></pre>
  
  <p>which gives : </p>
  
  <p></p>
  
  <p>I would now isolate UP but I don't know how to do this step. </p>
  
  <p>At the same time, I am not sure if it is useful to isolate UP. 
  Basically, could I execute : </p>
  
  <pre><code>var=`ip link show wlan0 | awk '/UP/ {print $3}'`
  if [ "$var" == "" ];then
     echo "interface did not up"
  else 
     echo "do something else.."
  fi 
  </code></pre>
  
  <p>thank in advance</p>