Jon Seymour wrote: > readlink -f will fully resolve links in the path itself (rather than > link at the end of the path), which was the behaviour I needed.
Ah, yes, well, as you could tell that was just a partial solution anyway. > It seems cd -P does most of what I need for directories and so > handling things other than directories is a small tweak on that. You might try cd'ing there and then using pwd -P to get the canonical directory name. I am thinking something like this: #!/bin/sh p="$1" dir=$(dirname "$p") base=$(basename "$p") physdir=$(cd "$dir"; pwd -P) realpath=$(cd "$dir"; ls -l "$base" | awk '{print$NF}') echo "$physdir/$realpath" | sed 's|//*|/|g' exit 0 Again, another very quick and partial solution. But perhaps something good enough just the same. Bob