Re: sed syntex in procmailrc question

Harry Putnam <[email protected]>
Newsgroups gmane.mail.procmail
Organization Still searching...
Message-ID <[email protected]>
Zhiliang <[email protected]> writes:

> I have a recipe wish 'sed' in one of my Smartlist rc, like:
>
>    sed 's/SUBJET/'"$SUBJ"/g
>
> which works fine.  I forgot where did I copied it from but have been
> puzzled by its syntex with respect to the use of the single quotes
> "'". Following what's described in sed tutorials I made it:
>
>    sed 's/SUBJET/"$SUBJ"/g'
>

I'm certainly not any kind of expert on sed but I think what you may
be seeing is really a shell expansion thing.

You an see the difference by echoing the two setups:

At a shell prompt:

  SUBJ=some2subject

Throw something at the sed recipies:

Then in this test, the variable $SUBJECT is allowed to expand:

  echo SUBJECT| sed 's/SUBJECT/'"$SUBJ/g"
   some2subject

-------        ---------       ---=---       ---------      -------- 

Here the variable $SUBJ is not allowed to expand

  echo SUBJECT| sed 's/SUBJECT/"$SUBJ"/g'
  $SUBJ
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.