title: How to assign to a bash variable the first result of locate?
body: <p>I can allocate a path to a certain variable from bash:</p>
  
  <pre><code>VAR1=/home/alvas/something
  </code></pre>
  
  <p>I can find it automatically:</p>
  
  <pre><code>$ cd
  $ locate -b "something" .
  /home/alvas/something
  /home/alvas/someotherpath/something
  </code></pre>
  
  <p><strong>But how do I assign the <em>first</em> result from locate as a variable's value?</strong></p>
  
  <p>I tried the following but it doesn't work:</p>
  
  <pre><code>alvas@ubi:~$ locate -b 'mosesdecoder' . | VAR1=
  alvas@ubi:~$ VAR1
  VAR1: command not found
  </code></pre>