linux - Determine if relative or absolute path in shell program -


As stated in the title, I need to determine that when a program is running, if the path relative Or complete:

  ./ program #relative dir / dir2 / program #relative ~ user / dir / dir2 / program #absolute / home / user / dir / dir2 / program #absolute   

These are my test cases, how can I do this in a shell program?

Or more generally, how to check that the path in this case, $ 0 is relative or complete?

  if [["$ 0" = / *]] then: # complete path: # Relative path    

Comments