Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jun 2006 00:33:10 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        sara lidgey <slidgey@yahoo.ca>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: multiple links with single ln command
Message-ID:  <20060627213310.GA2889@gothmog.pc>
In-Reply-To: <20060627181422.6917.qmail@web35702.mail.mud.yahoo.com>
References:  <20060627181422.6917.qmail@web35702.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2006-06-27 14:14, 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?

I don't think so.  The closest you can come to ``a single command''
would be a loop:

    $ for dirname in a b ; do ln -s test/c "test/$dirname/clink" ; done




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