Re: backticks in muttrc
On Mon, Jan 26, 2004 at 01:10:36PM -0800, Bob McElrath wrote:
> David Ellement [ellement@xxxxxxxxxx] wrote:
> > On 2004-01-25, Bob McElrath wrote
> > > This command should work:
> > >
> > > fcc-save-hook "~s (.*)" =`perl -e '$_="%s"; s/\[([A-Za-z0-9 _]+)\].*/$1/;
> > > print;'`
> > >
> > > but it does not. What about backtick evaluation is preventing this
> > > from working?
> >
> > Without single quotes around the backtick expression, the expression
> > will be evaluated at the time the line is parsed; within a hook, it is
> > likely that the intent is to defer evaluation until the hook is
> > activated.
>
> With single quotes it doesn't get evaluated at all.
>
> I wish this worked, but it does not:
> fcc-save-hook "~s (.*)" =$1
>
> Note that this does work:
> fcc-save-hook "~s (.*)" =`echo %s`
>
> but fails when the RHS is more complicated.
Does this work?
fcc-save-hook "~s (.*)" =`perl -e '$_=shift;s/\[([A-Za-z0-9_]+)\].*/$1/;print;'
%s`
Although I'm worried about what will happen when (.*) matches a string
containing metacharacters...
Ronald