title: Getting a "head: error reading 'path': is a directory" error
body: <p>I'm trying to get the first line of a file, but for some reason, the <code>head</code> command seems to be called on the parent directory, which obviously won't work.</p>
  
  <p>I have a variable <code>productPath</code> which contains the path to the file that I want to analyze. From executing an <code>echo</code> on that variable, I determined that the variable does indeed contain the correct path to the file I want to read. However, when I execute the following:</p>
  
  <pre><code>line = $(head -n 1 $productPath)
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>head: error reading 'src/test/resources/features/Env_First': Is a directory
  </code></pre>
  
  <p>The file is actually inside the <code>Env_First</code> directory. I tried executing <code>head</code> on a few other files, and all of them seem to be doing the same thing (always trying to read the parent directory, instead of the actual file). What would be the correct usage of <code>head</code> to get the first line of the file?</p>
  
  <p>EDIT:
  As per @bhristov's request, here is a minimal reproducible snippet. Here, I'm reading a file called <code>readableFile.feature</code> in the directory <code>src/test/environments</code>.</p>
  
  <pre><code>for productPath in $(find src/test/environments -maxdepth 1)
  do
        echo "$productPath" #this outputs src/test/environments/readableFile.feature 
        line=$(head -n 1 $productPath) #this produces the error mentioned earlier
  done
  </code></pre>