title: Check If Shell Script $1 Is Absolute Or Relative Path
body: <p>As the title says, I am trying to determine if my bash script receives a full path or a relative file to a directory as a parameter.</p>
  
  <p>For some reasons the following doesn't seem to work for me:</p>
  
  <pre><code>#!/bin/bash
  
  DIR=$1
  
  if [ "$DIR" = /* ]
  then
      echo "absolute"
  else
      echo "relative"
  fi
  </code></pre>
  
  <p>When I run my script with either a full path or absolute path it says:</p>
  
  <pre><code>./script.sh: line 5: [: too many arguments
  relative
  </code></pre>
  
  <p>For some reasons I can't seem to figure this bug. Any ideas?</p>