coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Absolute symlink created relatively to the current directory


From: Eric Blake
Subject: Re: Absolute symlink created relatively to the current directory
Date: Thu, 04 Apr 2013 06:33:21 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

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

[Prev in Thread] Current Thread [Next in Thread]