> ln -n will dereference a symlink, and produce another symlink to the
> hard target, which is interesting but not what the original question wanted.

This can be seen as design bug. Or a straightforward bug. ln -ns should
do as you describe, ln -n should do as I originally asked.

> ln $(readlink -fn symlinkname) hewhardlink

Bingo, readlink -f is the ticket. Thanks John + Jim!

Whether you put the -n is one of the same, the `` or $() remove newlines
anyway. What you do need to do is quote it:

  ln "$(readlink -f ...)" newname

Works with special characters, but is **SERIOUSLY UNSAFE** when used on
the file itself, not on a symlink, even when quoted. Create a file named
"aaa<newline>bb", and type the command below (use tab to complete the
aa.. name:

/bin/ln "$(readlink -f aaa
bb)" new
bash: bb: command not found
/bin/ln: accessing `': No such file or directory

8809 -rw-------  1   0 2005-07-11 12:01 aaa?bb
8810 lrwxrwxrwx  1   6 2005-07-11 12:02 sym -> aaa?bb

Otherwise it works fine, even when not in the current directory, but
needs a loop construction for multiple files/links.

Thanks everyone,

Volker

-- 
Volker Kuhlmann                 is possibly list0570 with the domain in header
http://volker.dnsalias.net/             Please do not CC list postings to me.

Reply via email to