title: Bash Script with command line arguments which are files
body: <p>I am trying to write a bash script which takes a file as a command line argument and appends the name of that file, the number of lines and the last modified date to the file. I am confused over how to access that file from within the bash script and how the command line arguments behave within the script.</p>
  
  <p>Here's my script so far:</p>
  
  <pre><code>#!/bin/bash
  
  filename = $1
  linecount = $(wc -l $1)
  lastmod = $(date -r $1)
  echo "$filename $linecount $lastmod" &gt;&gt; $1
  </code></pre>
  
  <p>I think I'm doing something wrong with the <code>$1</code> references. Generally confused about how to manipulate a command line argument that is a file.</p>