From owner-freebsd-questions Sun Dec 26 8:25: 3 1999 Delivered-To: freebsd-questions@freebsd.org Received: from sblake.comcen.com.au (sblake.comcen.com.au [203.23.236.144]) by hub.freebsd.org (Postfix) with ESMTP id 01C9F14A1E for ; Sun, 26 Dec 1999 08:25:00 -0800 (PST) (envelope-from aunty@sblake.comcen.com.au) Received: (from aunty@localhost) by sblake.comcen.com.au (8.9.3/8.9.3) id DAA31869; Mon, 27 Dec 1999 03:24:24 +1100 (EST) (envelope-from aunty) Date: Mon, 27 Dec 1999 03:24:24 +1100 From: aunty To: Mark Ovens Cc: freebsd-questions@FreeBSD.ORG Subject: Re: shell quoting problem? Message-ID: <19991227032424.E17780@comcen.com.au> References: <19991227014716.D17780@comcen.com.au> <19991226154822.C327@marder-1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre2i In-Reply-To: <19991226154822.C327@marder-1> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, Dec 26, 1999 at 03:48:22PM +0000, Mark Ovens wrote: > On Mon, Dec 27, 1999 at 01:47:16AM +1100, aunty wrote: > > After setting some variables in a bourne shell script, I want it > > to run a command like > > finger @nas1 | egrep "Host|tom|dick|harry" > > where nas1, tom, dick, and harry are expanded from variables. > > > > I can see _why_ things like this don't work > > finger \@${serv} | egrep \"Host${pipes-and-names}\" > > but can't figure out how to get all those quotes and pipes behaving. > > > > Is there a way to do this or must I resort to perl? > > > > Not quite sure exactly what you are trying to do here, If you go finger @host.domain.com you get a list of users online (usually forbidden these days). I'm grepping that list for particular people's names. These names and the host name are all generated from a script. > but whenever I use egrep(1) I always use ``()'' thus: > > # finger @nas1 | egrep '(tom|dick|harry)' > > Does this help at all? Yes thanks, that's a big improvement for the right hand side. Now it echoes fine from the script but I get no output from the command, probably the fault of that pesky pipe in the middle. > Merry Xmas. Ooooooh, yeah I forgot :-) We've just finished Boxing Day here. Merry whatever you're celebrating! -- Regards, -*Sue*- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message