zsh-users
 help / color / mirror / code / Atom feed
* create a symlink generically..
@ 2009-04-09  0:11 fREW Schmidt
  2009-04-09  0:53 ` fREW Schmidt
  2009-04-09  5:38 ` Bart Schaefer
  0 siblings, 2 replies; 8+ messages in thread
From: fREW Schmidt @ 2009-04-09  0:11 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

Hi all,

I am trying to make a script that will make a bunch of symlinks.  I want the
script to be able to be run from a number of locations, so I can't just do:

# ~/foo/bar is the current dir
ln -s ~/foo/bar/baz ~/baz

I can do:

cp -l baz ~/baz

but it makes hard links.

I was thinking that I could either have zsh do this:
ln -s ./baz ~/baz

and have it automatically expand ./baz to it's full path name.  Or maybe
there is some unix tool I don't know about.

Thanks for any tips at all!

-- 
fREW Schmidt
http://blog.afoolishmanifesto.com

[-- Attachment #2: Type: text/html, Size: 692 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: create a symlink generically..
  2009-04-09  0:11 create a symlink generically fREW Schmidt
@ 2009-04-09  0:53 ` fREW Schmidt
  2009-04-09  2:26   ` Matt Wozniski
  2009-04-09  5:38 ` Bart Schaefer
  1 sibling, 1 reply; 8+ messages in thread
From: fREW Schmidt @ 2009-04-09  0:53 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 746 bytes --]

On Wed, Apr 8, 2009 at 7:11 PM, fREW Schmidt <frioux@gmail.com> wrote:

> Hi all,
>
> I am trying to make a script that will make a bunch of symlinks.  I want
> the script to be able to be run from a number of locations, so I can't just
> do:
>
> # ~/foo/bar is the current dir
> ln -s ~/foo/bar/baz ~/baz
>
> I can do:
>
> cp -l baz ~/baz
>
> but it makes hard links.
>
> I was thinking that I could either have zsh do this:
> ln -s ./baz ~/baz
>
> and have it automatically expand ./baz to it's full path name.  Or maybe
> there is some unix tool I don't know about.
>
> Thanks for any tips at all!
>

I figured out one way to do it, but there may be a better way:

ln -s "$(pwd)/foo" ~/.foo

-- 
fREW Schmidt
http://blog.afoolishmanifesto.com

[-- Attachment #2: Type: text/html, Size: 1168 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: create a symlink generically..
  2009-04-09  0:53 ` fREW Schmidt
@ 2009-04-09  2:26   ` Matt Wozniski
  2009-04-09  2:36     ` Bryan Buecking
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Wozniski @ 2009-04-09  2:26 UTC (permalink / raw)
  To: fREW Schmidt, zsh-users

On Wed, Apr 8, 2009 at 8:53 PM, fREW Schmidt wrote:
> I figured out one way to do it, but there may be a better way:
>
> ln -s "$(pwd)/foo" ~/.foo

Well, $PWD should probably be used instead of $(pwd) wherever possible.

~Matt


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: create a symlink generically..
  2009-04-09  2:26   ` Matt Wozniski
@ 2009-04-09  2:36     ` Bryan Buecking
  2009-04-09  4:16       ` Matt Wozniski
  0 siblings, 1 reply; 8+ messages in thread
From: Bryan Buecking @ 2009-04-09  2:36 UTC (permalink / raw)
  To: Matt Wozniski; +Cc: fREW Schmidt, zsh-users

On Wed, Apr 08, 2009 at 10:26:14PM -0400, Matt Wozniski wrote:
> On Wed, Apr 8, 2009 at 8:53 PM, fREW Schmidt wrote:
> > I figured out one way to do it, but there may be a better way:
> >
> > ln -s "$(pwd)/foo" ~/.foo
> 
> Well, $PWD should probably be used instead of $(pwd) wherever possible.

Or /bin/pwd if you want the real path.

-- 
Bryan Buecking				http://www.starling-software.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: create a symlink generically..
  2009-04-09  2:36     ` Bryan Buecking
@ 2009-04-09  4:16       ` Matt Wozniski
  2009-04-09  5:34         ` Bryan Buecking
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Wozniski @ 2009-04-09  4:16 UTC (permalink / raw)
  To: Bryan Buecking, zsh-users

On Wed, Apr 8, 2009 at 10:36 PM, Bryan Buecking wrote:
> On Wed, Apr 08, 2009 at 10:26:14PM -0400, Matt Wozniski wrote:
>> On Wed, Apr 8, 2009 at 8:53 PM, fREW Schmidt wrote:
>> > I figured out one way to do it, but there may be a better way:
>> >
>> > ln -s "$(pwd)/foo" ~/.foo
>>
>> Well, $PWD should probably be used instead of $(pwd) wherever possible.
>
> Or /bin/pwd if you want the real path.

If I understand what you mean, you should be using "pwd -r" there...
No reason to fork for that.

~Matt


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: create a symlink generically..
  2009-04-09  4:16       ` Matt Wozniski
@ 2009-04-09  5:34         ` Bryan Buecking
  0 siblings, 0 replies; 8+ messages in thread
From: Bryan Buecking @ 2009-04-09  5:34 UTC (permalink / raw)
  To: Matt Wozniski; +Cc: zsh-users

On Thu, Apr 09, 2009 at 12:16:12AM -0400, Matt Wozniski wrote:
> On Wed, Apr 8, 2009 at 10:36 PM, Bryan Buecking wrote:
> > On Wed, Apr 08, 2009 at 10:26:14PM -0400, Matt Wozniski wrote:
> >
> > Or /bin/pwd if you want the real path.
> 
> If I understand what you mean, you should be using "pwd -r" there...
> No reason to fork for that.

The reason I choose /bin/pwd is that it's guaranteed to work on almost
all *nix/bsd systems and it's not shell specific.

-- 
Bryan Buecking				http://www.starling-software.com


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: create a symlink generically..
  2009-04-09  0:11 create a symlink generically fREW Schmidt
  2009-04-09  0:53 ` fREW Schmidt
@ 2009-04-09  5:38 ` Bart Schaefer
  2009-04-09 13:51   ` Johann "Myrkraverk" Oskarsson
  1 sibling, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2009-04-09  5:38 UTC (permalink / raw)
  To: zsh-users

On Apr 8,  7:11pm, fREW Schmidt wrote:
}
} I am trying to make a script that will make a bunch of symlinks. I
} want the script to be able to be run from a number of locations, so I
} can't just do:
}
} # ~/foo/bar is the current dir
} ln -s ~/foo/bar/baz ~/baz
} 
} I can do:
} 
} cp -l baz ~/baz
} 
} but it makes hard links.

Have you tried e.g.

  cp -r -s $PWD/baz ~/baz

??

Assuming you have access to GNU "cp".

I have a zsh function called "ltree" (no relation to the sorting
algorithm) that I wrote back in 1996 to copy directories by hard
or symbolic linkage; but I haven't used it in probably 10 years and
it certainly hasn't been confirmed to work with zsh newer than
3.0.x (and maybe not even that new), so I'm hesitant to post it.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: create a symlink generically..
  2009-04-09  5:38 ` Bart Schaefer
@ 2009-04-09 13:51   ` Johann "Myrkraverk" Oskarsson
  0 siblings, 0 replies; 8+ messages in thread
From: Johann "Myrkraverk" Oskarsson @ 2009-04-09 13:51 UTC (permalink / raw)
  To: Zsh Users

Hi all,

On Thu, Apr 9, 2009 at 5:38 AM, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Apr 8,  7:11pm, fREW Schmidt wrote:

> I have a zsh function called "ltree" (no relation to the sorting
> algorithm) that I wrote back in 1996 to copy directories by hard
> or symbolic linkage; but I haven't used it in probably 10 years and
> it certainly hasn't been confirmed to work with zsh newer than
> 3.0.x (and maybe not even that new), so I'm hesitant to post it.

There is also lndir, available here:

http://www.mit.edu/afs/sipb/project/sipbsrc/rt/lndir/

and possibly other places, though I don't know how helpful it is to the OP.


Johann


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-04-09 13:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-09  0:11 create a symlink generically fREW Schmidt
2009-04-09  0:53 ` fREW Schmidt
2009-04-09  2:26   ` Matt Wozniski
2009-04-09  2:36     ` Bryan Buecking
2009-04-09  4:16       ` Matt Wozniski
2009-04-09  5:34         ` Bryan Buecking
2009-04-09  5:38 ` Bart Schaefer
2009-04-09 13:51   ` Johann "Myrkraverk" Oskarsson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).