gnu-misc-discuss
[Top][All Lists]
Advanced

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

Re: symlink weirdness


From: Roger Dahl
Subject: Re: symlink weirdness
Date: 14 Sep 2004 09:17:20 -0700

Sam Holden <sholden@flexal.cs.usyd.edu.au> wrote in message 
news:<slrnckcp54.1la.sholden@flexal.cs.usyd.edu.au>...
> On 13 Sep 2004 17:11:56 -0700, Roger Dahl <rdnews@dahlsys.com> wrote:
> > If your current directory is A and you want to create a relative
> > symlink to a file in directory B in directory C, you need to type the
> > path as it would look from C, not from A.
> >
> > Though I understand that this makes 'ln' very simple (it just copies
> > the argument into the link file), it doesn't make sense from a users
> > perspective. When I'm in A, I can 'cp' from B to C without figuring
> > out what the path to C will look like from B. 'cp -s' is even worse --
> > it can only make links in the current directory.
> >
> > This oddity complicates writing scripts that create symlinks. We need
> > more intelligent 'ln' and 'cp -s', that, given paths from A to B and
> > from A to C can create links between B and C.
> >
> > Any thoughts?
> 
> If that was the case then how would I get the current behaviour for the
> times that I want it.
> 
> I can get the behaviour you want with the current ln by doing
> something like:
> 
> ln -s `pwd`/$B $C

Hi Sam,

That would create an absolute link. I'm looking for a better way to
create relative links.

> (though it'd be better to to remove the /../ that might appear).
> 
> if ln did what you are suggesting then how would I get the current
> behaviour of:
> 
> ln -s ../init.d/ssh /etc/rc0.d/K20ssh
> 
> (Note: I want the symlink to have '..' in it and my current directory is
> not /etc/rc0.d).

I was thinking it would be a new switch that would turn on the
additional functionality.

> Wouldn't a simple tool that takes two arguments a directory A and a path B
> and outputs path C that is the same location as B from A. 
> 
> After all why should ln be special and have such logic when other tools
> might also benefit. You'd use:
> 
> ln -s `relpath $C $B` $C

Though I can't off the top of my head think of any other tools that
might benefit from it, I like that idea.

Thanks,

Roger

reply via email to

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