title: Storing directory as a variable for later use in linux script
body: <p>In my script, I am holding the location (path) of a file as a variable.</p>
  <p>For example, fileA</p>
  <p>An example of its contents are</p>
  <p>fileA=/usr/anotherfolder/somefold/&quot;filenamehere&quot;</p>
  <p>However, when i call a command on the file in the script such as:</p>
  <p>cat $fileA</p>
  <p>or</p>
  <p>cat &quot;$fileA&quot;</p>
  <p>I get an error saying the file or directory doesn't exist. If I echo $fileA to see what the output is, and then run a cat manually from the terminal, it works fine, don't know what is going wrong. Any help?</p>
  <p>Some debug info:</p>
  <ul>
  <li>fileA='/home/jacob/Desktop/CS35L/WORK/2/hw/test3/&quot;new&quot;'</li>
  <li>echo '/home/jacob/Desktop/CS35L/WORK/2/hw/test3/&quot;new&quot;'
  /home/jacob/Desktop/CS35L/WORK/2/hw/test3/&quot;new&quot;</li>
  <li>'[' '!' -r '/home/jacob/Desktop/CS35L/WORK/2/hw/test3/&quot;new&quot;' ']'</li>
  </ul>
  <p>For these particular lines</p>
  <h1>Check for readable file</h1>
  <pre><code>echo $fileA
  if [ ! -r &quot;$fileA&quot; ]
  then
      o=`expr $o + 1`
      echo &quot;$fileA not readable.&quot;
      continue    
  fi
  </code></pre>