Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jun 2006 08:20:48 -0400
From:      Paul Chvostek <paul+fbsd@it.ca>
To:        dw <dwinner-lists@att.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: need help w/ simple bash script
Message-ID:  <20060627122048.GB52604@it.ca>
In-Reply-To: <44A11E2D.3010006@att.net>
References:  <44A11E2D.3010006@att.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Hiya.

I've been working on a web front-end to aggregate multiple servers'
package update requirements as well.  I'll probably have it ready to
present in another few weeks, if ${DAYJOB} doesn't get in the way.

On Tue, Jun 27, 2006 at 08:01:49AM -0400, dw wrote:
> 
> # REPORT=`pkg_version -v`
> 
> But when I "echo $REPORT", I get:
> 
> Xaw3d-1.5E_1 = up-to-date with port apr-db42-1.2.7_1 = up-to-date with 
...
> When what I want is:
> 
> Xaw3d-1.5E_1 = up-to-date with port
> apr-db42-1.2.7_1 = up-to-date with port
...

Use more quotes.

  REPORT = "`pkg_version -v`"

will protect the newlines.

> for LINE in `pkg_version -v`; do echo $LINE; done

If you feel adventurous, you could to try something like this:

  tmpfile=/tmp/`basename $0`.$$
  trap "rm -f $tmpfile $tmpfile.?" 0 1 2 3 5 15
  pkg_version -v | while read package status text; do
    echo "$package $text" >> $tmpfile."$status"
  done

Now you have tempfiles with package lists for the various stati, which
you can parse as you see fit.

Note that you may get better (i.e. more useful) mileage out of something
like:

  pkg_version -vL=

which will show you only what needs to be updated.

-- 
  Paul Chvostek                                             <paul@it.ca>
  it.canada                                            http://www.it.ca/




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