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

Re: wildcards



I've got a related question which is:  I know that I have to use eval to
match against dynamic patterns if they contain metacharacters, but what
happens if this pattern contains ``^''?  What's the best way to quote these
characters before I eval, otherwise I'd get a syntax error?

; pat = \*
; ~ foo $pat && echo matched
; eval \~ foo $pat && echo matched
matched
; pat = \*\^
; eval \~ foo $pat && echo matched
<eval>:1: syntax error

Pete.