Subject: Re: sh "if foo -qe bar"???
To: Masao Uebayashi <uebayasi@pultek.co.jp>
From: Michael South <msouth@msouth.org>
List: tech-pkg
Date: 06/17/2003 21:37:28
Duh... Thanks guys. I was totally focused on comparing two strings and
didn't even think about what ${PKG_INFO} _meant_.
Mike
Jeremy C. Reed wrote:
> On Tue, 17 Jun 2003, Michael South wrote:
>
>
>> if ! ${PKG_INFO} -qe "${PKGNAME}" ; then blah blah blah
>
>
> Replying off-list:
>
> man pkg_info
>
> -q is quiet
> -e pkgname tests if exists (returns 0 if installed)
>
> For example:
>
> rainier:~$ pkg_info -e apache
> rainier:~$ echo $?
> 1
> rainier:~$ pkg_info -e perl
> perl-5.6.1nb7
> rainier:~$ echo $?
> 0
>
>
> Take care,
>
> Jeremy C. Reed
> http://bsd.reedmedia.net/
Masao Uebayashi wrote:
> sh(1)'s "if" takes not only test(1) but also any other commands.
>
> "[ ... ]" is another form of test(1).
>
> So,
>
> if [ "foo" = "bar" ]; then ...; fi
>
> and
>
> if test "foo" = "bar"; then ...; fi
>
> are identical.
>
> Masao
--
Michael South
msouth@msouth.org
(831) 338-8014
(949) 355-4852 (cell)