9fans archive / 2008 / 01 / 534 /    prev next

From: "roger peppe" <rogpeppe@gma...>
Subject: Re: [9fans] quouteing(?) problems in rc
Date: Wed, 30 Jan 2008 13:04:58 +0000

>         grep -n -e '''' ^  '^' ^ $func ^ '''' $file /dev/null

your problem is that you're constructing a list containing quotes
suitable for input to the shell, but you really want to construct
a list containing values suitable for arguments to grep.
i think what you want is:

grep -n -e '^'^$func $file /dev/null

which of course will only work correctly if $func contains no
regexp metacharacters, but i'm sure you know that.