Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jun 2006 15:54:54 -0700 (PDT)
From:      Brian O'Shea <b_oshea@yahoo.com>
To:        sara lidgey <slidgey@yahoo.ca>, freebsd-questions@freebsd.org
Subject:   Re: multiple links with single ln command
Message-ID:  <20060627225455.11547.qmail@web39512.mail.mud.yahoo.com>
In-Reply-To: <20060627181422.6917.qmail@web35702.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Unfortunately, it is impossible with the current syntax of the
ln command.  It does allow you to specify multiple sources as
arguments though, with a final argument naming a target directory
in which to create the links to the source files.  For example:

    $ mkdir test
    $ mkdir test/a
    $ mkdir test/b
    $ mkdir test/c
    $ mkdir links
    $ cd ./links
    $ ln -s ../test/* .
    $ ls -l
    lrwxr-xr-x  1 boshea  boshea  9 Jun 27 15:50 a -> ../test/a
    lrwxr-xr-x  1 boshea  boshea  9 Jun 27 15:50 b -> ../test/b
    lrwxr-xr-x  1 boshea  boshea  9 Jun 27 15:50 c -> ../test/c

However, this is not exactly what you are trying to do in your
example; you are trying to create multiple target links with the
same name in different directories.  Unfortunately, because the ln
command's syntax allows you to specify multiple source files, it
would be ambiguous to try to make it also allow you to specify
multiple targets.

Hope that helps.
-brian

--- sara lidgey <slidgey@yahoo.ca> wrote:

> Hi All,
> 
> I've read the man page for ln but can't find a way to do this.  I want to
> create multiple links to a single directory with one command.  Consider the
> following example.  I have a directory structure like this:
> test/a/
> test/b/
> test/c/
>  I want to create a symbolic link called "clink" in test/a/ and test/b/ which
> points to test/c/
> 
> The only way I know to do this is with two commands:
> ln -s test/c test/a/clink
> ln -s test/c test/b/clink
> 
> Can it be done with a single command?
> 
> thanks.  sorry if this is a no-brainer,
> S
> 
>  		
> ---------------------------------
> Now you can have a huge leap forward in email: get the new Yahoo! Mail. 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060627225455.11547.qmail>