title: Determine if relative or absolute path in shell program
body: <p>As stated in the title, I need to determine when a program is ran if the path is relative or absolute:</p>
  
  <pre><code>./program #relative
  dir/dir2/program #relative
  ~User/dir/dir2/program #absolute
  /home/User/dir/dir2/program #absolute
  </code></pre>
  
  <p>This are my test cases. How exactly could I go about doing this in a shell program? </p>
  
  <p>Or more generally, how to check if a path, <code>$0</code> in this case, is relative or absolute?</p>