Determine if relative or absolute path in shell program
if [[ "$0" = /* ]]
then
: # Absolute path
else
: # Relative path
fi
A general solution for any $path
, rather than just $0
POSIX One Liner
[ "$path" != "${path#/}" ] && echo "absolute" || echo "relative"