if [[ "$0" = /* ]]
then
: # Absolute path
else
: # Relative path
fi
$path
の一般的な解決策 $0
だけではなく
POSIX ワンライナー
[ "$path" != "${path#/}" ] && echo "absolute" || echo "relative"
if [[ "$0" = /* ]]
then
: # Absolute path
else
: # Relative path
fi
$path
の一般的な解決策 $0
だけではなく
[ "$path" != "${path#/}" ] && echo "absolute" || echo "relative"