title: shell, match a string in terminal output
body: <p>i will go and see if my touch screen calibrated with a own script.
  But i have really few experience with shell scripts. I hope anyone can help me.</p>
  
  <p>My idea is it to execute <code>xinput --list-pros &lt;device&gt;</code> and check the terminal output with the entry <code>...(242): &lt;no items&gt;</code>. 
  This is the option if the touch screen not calibrated else there are the <code>x/y</code> coordinates like <code>...(242): 1 22 333 4444</code>.</p>
  
  <p>In my script I will execute <code>xinput --list-pros &lt;device&gt;</code> and check with <code>grep</code> is there a entry <code>(242)</code> and then check the same line if there a entry <code>&lt;no items&gt;</code>. But i fail to read the output from <code>xinput --list</code>.</p>
  
  <pre><code># read the terminal output from xinput
  $xinput_output= less xinput --list-pros 7
  
      while read $xinput_output
      do
           # check first line from output
           grep "242" $xinput_output
           if [ $? != 0]
           then
               break;
           else
               # found 242 check x/y coordinates
               grep "&lt;no items&gt;" $xinput_ouput
               if [ $? != 0]
               then
                   #no x/y coordinates, execute xinput_calibration
                   xinput_calibration
                   exit 0
               fi
           fi
  
      done &lt; $1
  </code></pre>