title: Need to assign the contents of a text file to a variable in a bash script
body: <p>I am very new to making bash scripts, but my goal here is to take a .txt file I have and assign the string of words in the txt file to a variable. I have tried this (no clue if I am on the right track or not).</p>
  
  <pre><code>#!/bin/bash
  FILE="answer.txt"
  file1="cat answer.txt"
  print $file1
  </code></pre>
  
  <p>When I run this, I get </p>
  
  <pre><code>Warning: unknown mime-type for "cat" -- using "application/octet-stream"
  Error: no such file "cat"
  Error: no "print" mailcap rules found for type "text/plain"
  </code></pre>
  
  <p>What can I do to make this work?</p>
  
  <p>Edit**
  When I change it to:</p>
  
  <pre><code>#!/bin/bash
      FILE="answer.txt"
      file1=$(cat answer.txt)
      print $file1
  </code></pre>
  
  <p>I get this instead:</p>
  
  <pre><code>Warning: unknown mime-type for "This" -- using "application/octet-stream"
  Warning: unknown mime-type for "text" -- using "application/octet-stream"
  Warning: unknown mime-type for "string" -- using "application/octet-stream"
  Warning: unknown mime-type for "should" -- using "application/octet-stream"
  Warning: unknown mime-type for "be" -- using "application/octet-stream"
  Warning: unknown mime-type for "a" -- using "application/octet-stream"
  Warning: unknown mime-type for "varible." -- using "application/octet-stream"
  Error: no such file "This"
  Error: no such file "text"
  Error: no such file "string"
  Error: no such file "should"
  Error: no such file "be"
  Error: no such file "a"
  Error: no such file "varible."
  </code></pre>
  
  <p>When I enter cat answer.txt it prints out this text string should be a varible like it should but, I still can't get the bash to do that with the varible.</p>