Quoting Mike Miller <mbmiller+l at gmail.com>:

> On Mon, 9 Dec 2013, canito at dalan.us wrote:
>
>> Quoting Mike Miller <mbmiller+l at gmail.com>:
>>
>>> I'm not sure of exactly what your issue is.  I'm thinking you need  
>>> the "--", so I made a script with that, exactly like this:
>>>
>>>
>>> -------begin script on next line---------
>>> #!/bin/bash
>>>
>>> PATTERN=$1
>>>
>>> grep -Eic -- "$PATTERN"
>>> -------end script on previous line---------
>>>
>>>
>>> And I ran it:
>>>
>>>
>>> $ echo -e "-testa\n-testb\nblah\nfoo\nbar\ntest\na-test" | ./script -test
>>> 3
>>>
>>>
>>> That's the right answer.  Note that if you don't have a filename,  
>>> you have to grep from stdin, which is what I did.
>>>
>>> Mike
>>
>> Thank you Mike-
>>
>> Not sure what the problem is either. I've had a couple of issues  
>> with egrep/grep on Red Hat.
>>
>> Again, I do appreciate the follow up.
>
>
> What version of grep are you using?  This is mine:
>
> $ grep --version
> GNU grep 2.5.4
>
> $ egrep --version
> GNU grep 2.5.4
>
> I read somewhere a few years ago that egrep was deprecated and that  
> we were supposed to use "grep -E" instead.  I doubt that's the  
> problem (at least on my system, I get the same result with egrep as  
> with "grep -E").
>
> I know that earlier versions of the perl grep, grep -P, were pretty  
> buggy but I've had better luck recently.
>
> Mike

grep --version
GNU grep 2.6.3

Pretty weird. I'll just assume user error.

cat param.sh
#!/bin/bash
set -x

echo $1
FUNC=$1

grep -Eic -- "$FUNC"

./param.sh --test

+ echo --test
--test

+ FUNC=--test

+ grep -Eic -- --test
^C

It just hangs, which is weird. I was under the impression that one  
could grep variables.

SDA

> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> tclug-list at mn-linux.org
> http://mailman.mn-linux.org/mailman/listinfo/tclug-list