title: Im learning bash, confused with command line arguments
body: <p>I need to create a script that allows a command line argument to be passed and checked to see if it exists as a directory within the directory im running the script in. If it does list the contents and if it doesnt print a error message.
  So at the command line I should type ./check.sh test(existing directory)
  and the script should run. Now I don't understand how to use test which should be $1. In the script I want to  take $1 and check it against existing directories. however if i do something like:</p>
  
  <pre><code>#!/bin/bash
  DIR=$1
  cd DIR
  ls
  </code></pre>
  
  <p>it doesn't work because DIR doesn't take on the argument(in this case test)
  I know I need to use an if-else block but I dont understand how to get the information I need to begin with. Please someone help me figure this out.</p>