a readlink alternative in bash test script

Perhaps, it's better for mac.