remove the loop in script, use readlink -f instead