From owner-freebsd-questions@FreeBSD.ORG Sat Nov 29 06:31:19 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AA8C106564A for ; Sat, 29 Nov 2008 06:31:19 +0000 (UTC) (envelope-from tajudd@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26]) by mx1.freebsd.org (Postfix) with ESMTP id EDC7B8FC08 for ; Sat, 29 Nov 2008 06:31:18 +0000 (UTC) (envelope-from tajudd@gmail.com) Received: by ey-out-2122.google.com with SMTP id 6so704174eyi.7 for ; Fri, 28 Nov 2008 22:31:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=PG9PMx2Qw8ALsiUo8l3tDpeMOZc/RDbQm7JZB37iQiE=; b=ETOq/kZbGkaPA90qfZWVzmaEGl6yJewQ8VOpSe63O++jywlgX7xylWi1cGTxQp+WvP rm/3HcqO4Ik71VKp5pgUMMNmFkNjPHrta5eyq7Bndrn7hCa9m4mNdY13tpFAQqH1avrH oV4inHbYVH3EMqyOXu9NMh9JA+9uM7/drbhXI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=W6EHf7LM9InCRhBVGOY4vsb69RCa4fMrqvfm7cuOahWlVfKUqw7uTZ4ncvz8AYY2D9 cZ0FBHR4bTD/jQCC9/yonFbdcR2Un+r0jRrkj/HoSW5aTTIEROkQSKDJJ2+c+V3trmZG 1XsagllfxGQCRyBHkI3S7xSgqceo0wnNhJsgs= Received: by 10.210.49.19 with SMTP id w19mr9813032ebw.149.1227940277765; Fri, 28 Nov 2008 22:31:17 -0800 (PST) Received: by 10.210.17.12 with HTTP; Fri, 28 Nov 2008 22:31:17 -0800 (PST) Message-ID: Date: Fri, 28 Nov 2008 23:31:17 -0700 From: "Tim Judd" To: "freebsd-questions@freebsd.org" In-Reply-To: <20081129060801.GA41353@shepherd> MIME-Version: 1.0 References: <20081129060801.GA41353@shepherd> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: shell scripting problems 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: Sat, 29 Nov 2008 06:31:19 -0000 I'm sure it's faulty Which is why I'm asking for help My regexes (in it's various forms) produce the output similar to: xorg-fonts-75dpi xorg-fonts xorg-fonts-100dpi ... ... ... and I'm wanting my regex to return the 2nd value, in this example, in this list. The problem is the shell is taking the end anchor $ as the start of a variable, and no matter how I escape it, it seems to never work. I'm sorry for not explaining properly. Maybe the above would help. On Fri, Nov 28, 2008 at 11:08 PM, Sahil Tandon wrote: > Tim Judd wrote: > > > I've been trying for a few weeks to try to get this to work, and the > /bin/sh > > keeps snagging the command line before passing it to pkg_info > > > > I'll use a different shell if I need to, but since I got everything > except > > this one thing working, i'd rather keep it in sh > > > > In the shell script, i have a > > pkg_info -qLx "^$PKG-[0-9,._]+$" > > also tried (-X)tended regex instead of the standard rege(-x). > > > > sh keeps erroring out saying various $" isn't a valid variable name, or > > pkg_info doesn't find the anything there. And it does exist. This all > came > > around with me trying to automatically update a bunch of ports. > xorg-fonts > > is outdated, but xorg-fonts-100dpi or xorg-fonts-75dpi isn't. So the > regex > > returns multiple values (as above). I just want the first, hence the > > anchors. > > > > Any ideas on how to get sh to let pkg_info see everything? Various > escaping > > around the end $ just doesn't work. I'll keep working on it, but i'd > like > > to see how you all would suggest getting it to work. > > I am not sure what the problem is, but are you just looking for the > output of "pkg_info -qxL" on the *first* instance of xorg-fonts-*? > > % pkg_info -qL `pkg_info | grep xorg-fonts | head -1 | cut -d\ -f1` > > FWIW, your regexp also looks faulty. > > -- > Sahil Tandon > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >