[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: scripting question



On Wed, Apr 16, 2003 at 12:23:46PM +0100, Colin Watson wrote:
> On Tue, Apr 15, 2003 at 07:23:06PM -0700, Alvin Oga wrote:
> > -- and be careful, that what you type on a command line will NOT
> >    necessarily work in a bash script
> > 
> > 	root#  ls -la /home/foo  | grep -iv "ignore|this|and|that" 
> > 
> > 	will need to be 'escaped' in some scripts and not others
> 
> That's wrong just to start with. Use egrep if you want to use '|' for
> alternatives. With grep, use '\|', and put single quotes around it, not
> double. Double quotes are asking for trouble unless you explicitly want
> their expansion effects.
> 
Well,

	grep foo "ignore\|this\|and\|that" -v

works for me but

	grep foo 'ignore\|this\|and\|that' -v

doesn't.


David



Reply to: