if [[ "$0" = /* ]]
then
: # Absolute path
else
: # Relative path
fi
Solusi umum untuk $path
apa pun , bukan hanya $0
POSIX One Liner
[ "$path" != "${path#/}" ] && echo "absolute" || echo "relative"
if [[ "$0" = /* ]]
then
: # Absolute path
else
: # Relative path
fi
Solusi umum untuk $path
apa pun , bukan hanya $0
[ "$path" != "${path#/}" ] && echo "absolute" || echo "relative"