Subject: Re: sh "if foo -qe bar"???
To: None <tech-pkg@netbsd.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: tech-pkg
Date: 06/17/2003 21:13:55
Michael South <msouth@msouth.org> wrote:
> OK, I give up. How the blazes does this work?
> 
> bsd.pkg.mk:
> 
>    if ! ${PKG_INFO} -qe "${PKGNAME}" ; then blah blah blah
> 
> (a) Why doesn't it have brackets ([, ]) around the conditional?

Because a command is executed.

> (b) What is "-qe" supposed to do?

Passed the command-line arguments "-qe" to the command "${PKG_INFO}".

> (c) Why does it work within make and not interactively?

Because only when using bsd make within pkgsrc is the variable
"${PKG_INFO}" defined.

But it would work with other variables as well.  Behold:

$ export PKG_INFO=false
$ if ! ${PKG_INFO} ; then echo "true"; fi
true
$ 

-Jan

-- 
http://www.netbsd.org -
         Multiarchitecture OS, no hype required.