Short answer: "readlink". See below ... Christopher Sawtell wrote: > $ ln $(stat Soft_Link_to_f1 | grep '^ File:' | cut -d "\`" -f3 | \
stat is a very interesting command, and worth looking at :-) Thanks Chris! > It begs the question: Is the current behaviour of ln a bug or a feature? Feature - along with the whole "thou shalt not open a directory file" thing, which is based on the filesystem afaik. On FreeBSD you can still directly access and manipulate directory files. Of course, that means that you can dereference files without changing the link counts in the ilist, which is a bad thing, requiring fsck to fix :-) ln -n will dereference a symlink, and produce another symlink to the hard target, which is interesting but not what the original question wanted. Manually dereferencing your original symlink can be misleading - you also have to go and check that the dereference is in the same filesystem as you, or else the hard link will fail. Of course, if it's in the same directory (as it is in these examples) then there's no issue. There are very few commands that work with symlinks ... however, readlink is the one that you want (discovered with 'man -k symbolic') ln $(readlink -fn symlinkname) hewhardlink $ ls -li total 4 3679680 -rw-r--r-- 1 jim jim 6 2005-07-11 11:04 hello 3679681 lrwxrwxrwx 1 jim jim 5 2005-07-11 11:05 hi -> hello $ ln $(readlink -fn hi) greetings $ ls -li total 8 3679680 -rw-r--r-- 2 jim jim 6 2005-07-11 11:04 greetings 3679680 -rw-r--r-- 2 jim jim 6 2005-07-11 11:04 hello 3679681 lrwxrwxrwx 1 jim jim 5 2005-07-11 11:05 hi -> hello -jim
