title: How do you use a local variable in a bash function?
body: <p>I have a test list of all the Cards Against Humanity white cards. My goal is to type in rancard and get a random card's string back from the caghw.txt file. So if 212 is the random number, then line 212 is printed. This is what I have in my .bashrc:</p>
  
  <pre><code>rancard ()
  {
      card=echo $((1 + RANDOM % 706))
  
      #I'm trying to take the random value returned from
      #the math function above and use it as an argument
      #to the head command
  
      head -$card /root/caghw.txt | tail -1
  }
  </code></pre>
  
  <p>What am I doing wrong? I know I have the general idea right but am not too familiar with the syntax.</p>
  
  <p>As a disclaimer, this isn't for school or anything. It's for my own amusement.</p>