Cool, I didn’t realise how readlink operated, but found out a bit more in the answers to [Wayback] symlink – How to get full path of original file of a soft symbolic link? – Unix & Linux Stack Exchange, thanks to [Wayback] daisy, [Wayback] Peter.O and [Wayback] Gilles ‘SO- stop being evil’:
- Try this line:
readlink -f `which command`If
commandis in your$PATHvariable , otherwise you need to specify the path you know.
-fwill return a path to a non-existent final target, so long as the intermediate link targets exist… Use-eto avoid this, ie.-ewill return null if the final target does not exist. – Peter.O- Under Linux,
readlinkreads the contents of a symlink, andreadlink -ffollows symlinks to symlinks to symlinks, etc., until it finds something that isn’t a symlink.
–jeroen





