How to install a bunch of packages in a list?
Brandon Allbery
allbery.b at gmail.com
Mon Mar 19 04:08:14 PDT 2012
On Sun, Mar 18, 2012 at 21:34, Jeremy Lavergne
<jeremy at lavergne.gotdns.org>wrote:
> > Here is the command and the list of packages that I got:
> > http://bin.cakephp.org/view/1705726929
> >
> > Well, I have this list, it's good, but what I would like to do is just
> install everyone of those packages. Any ideas?
>
> Instead of `port list` maybe `port echo "*ocaml*"`. At that point, you can
> pipe it through tr to have a space-delimited list, or you can have bash for
> loop across them.
>
You don't need to remap the newlines; the output of a command in `` or $()
is word-split, not line-split, and \n is just another kind of space as far
as the word splitting algorithm in the shell is concerned.
> sudo port -p install `port echo "*ocaml*" | tr '\n' ' '`
>
$ sudo port -p install `port echo "*ocaml*"`
works just fine.
That said, that's still more work than is needed; last I checked, glob
patterns worked perfectly fine but need to be escaped from the shell. (In
fact, that they work with "port echo" should have told you this.)
$ sudo port -p install '*ocaml*'
--
brandon s allbery allbery.b at gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20120319/ebaf5c5b/attachment.html>
More information about the macports-users
mailing list