View Single Post
Old 8th November 2008
ocicat ocicat is offline
Join Date: Apr 2008
Posts: 3,295

Originally Posted by mfaridi View Post
when I run
pkg_add -rv `make show=pkgname | awk '{if(NF==1) print $1}'`
I see this error

/usr/sbin/pkg_add: Missing pkgname
Usage: pkg_add [-acIinqruvx] [-A arch] [-B pkg-destdir] [-F keywords]
       [-L localbase] [-P type] [-Q quick-destdir] pkg-name [...]
Correct. Look at the output of the following to see why:

$ make show=pkgname

...where the output is:
===> x11/gnome/alacarte

===> x11/gnome/applets2

===> x11/gnome/at-spi

===> x11/gnome/audio

===> x11/gnome/backgrounds

===> x11/gnome/baker

===> x11/gnome/build
Piping this output into the awk script if (NF == 1) print $1; will generate no output because the script looks for lines containing only one field. There is no lines found in the output of make show=pkgname which only contains one field.

As has been mentioned to you before, you need to understand what the commands used do. If you don't understand, learn. This is what will make your efforts effective.

The Perl script I supplied strips out everything except for the name of the package. Don't only use it, but find an online tutorial to explain what it does. Read the manpage to perl(1) too. Learn.
Reply With Quote