From owner-freebsd-questions@FreeBSD.ORG Tue Jun 27 12:21:45 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 85D6616A403 for ; Tue, 27 Jun 2006 12:21:45 +0000 (UTC) (envelope-from paul+fbsd@it.ca) Received: from mail2.dm.egate.net (mail2.dm.egate.net [216.235.1.136]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA2A143D67 for ; Tue, 27 Jun 2006 12:21:38 +0000 (GMT) (envelope-from paul+fbsd@it.ca) Received: from mail.it.ca (root@[216.235.7.67]) by mail2.dm.egate.net (8.12.11/8.12.10) with ESMTP id k5RCLcts051304; Tue, 27 Jun 2006 08:21:38 -0400 (EDT) (envelope-from paul+fbsd@it.ca) Received: from mail.it.ca (paul@mail [216.235.7.67]) by mail.it.ca (8.13.3/8.13.3) with ESMTP id k5RCKmjH086061; Tue, 27 Jun 2006 08:20:49 -0400 (EDT) (envelope-from paul+fbsd@it.ca) Received: (from paul@localhost) by mail.it.ca (8.13.3/8.13.3/Submit) id k5RCKmhS086060; Tue, 27 Jun 2006 08:20:48 -0400 (EDT) (envelope-from paul+fbsd@it.ca) X-Authentication-Warning: mail.it.ca: paul set sender to paul+fbsd@it.ca using -f Date: Tue, 27 Jun 2006 08:20:48 -0400 From: Paul Chvostek To: dw Message-ID: <20060627122048.GB52604@it.ca> References: <44A11E2D.3010006@att.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44A11E2D.3010006@att.net> User-Agent: Mutt/1.5.11 Cc: freebsd-questions@freebsd.org Subject: Re: need help w/ simple bash script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jun 2006 12:21:45 -0000 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 it.canada http://www.it.ca/