Date: Mon, 27 Dec 1999 03:24:24 +1100 From: aunty <aunty@comcen.com.au> To: Mark Ovens <mark@dogma.freebsd-uk.eu.org> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: shell quoting problem? Message-ID: <19991227032424.E17780@comcen.com.au> In-Reply-To: <19991226154822.C327@marder-1> References: <19991227014716.D17780@comcen.com.au> <19991226154822.C327@marder-1>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991227032424.E17780>