On 04/04/2013 03:54 AM, Rémy Lefevre wrote:
> However, this feature is only available for relative symlink and not for
> absolute one. So, my proposal is to add a --absolute option to ln, in order
> to allow absolute symlink creation by providing target_path relatively to
> the current directory.

Why?  All you have to do is update your script to change:

ln -s relative name

into:

ln -s "$PWD"/relative name

Adding --relative made it possible to do something that is very
difficult to do in shell (and impossible to do without forking); but as
shell already makes it very easy to turn a relative path into an
absolute one (and with no forking required), I'm not convinced that it
is worth bothering to add an --absolute.  Let's even consider if a
script is doing:

ln -s "$target" name

where it is not known whether target is absolute or relative.  Yes,
adding --absolute might make it guaranteed to handle both styles of
$target; but it's still something the shell can already do:

case $target in
  /*) ln -s "$target" name ;;
  *) ln -s "$PWD/$target" name ;;
esac

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to