title: Check number of arguments passed to a Bash script
body: <p>I would like my Bash script to print an error message if the required argument count is not met.</p>
  
  <p>I tried the following code:</p>
  
  <pre><code>#!/bin/bash
  echo Script name: $0
  echo $# arguments 
  if [$# -ne 1]; 
      then echo "illegal number of parameters"
  fi
  </code></pre>
  
  <p>For some unknown reason I've got the following error:</p>
  
  <pre><code>test: line 4: [2: command not found
  </code></pre>
  
  <p>What am I doing wrong?</p>