Replacing readlink bash command with no dependency bash function