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

Re: scripting question

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.

Colin Watson                                  [cjwatson@flatline.org.uk]

Reply to: