title: Comparing two dates in Linux bash shell script
body: <p>I'm trying to compare two dates. The system date vs a file date. I'm having trouble and the error I am getting is this:</p>
  
  <blockquote>
    <p>./hello.sh: line 25: [10-18-2018: command not found</p>
  </blockquote>
  
  <p>I have also tried with =,==,-eq.</p>
  
  <pre><code>#Setting variable
  now=$(date +"%m-%d-%Y")
  #Testing variable        
  echo "Current System Date: $now"
  #Setting variable        
  filedate=$(date -r hello.sh "+%m-%d-%Y")
  #Testing variable        
  echo "hello.sh date: $filedate"
  
  if [$now -ge  $filedate]
  then
  echo This statement works
  else
  echo This statement didnt work
  fi
  </code></pre>