procmail
[Top] [All Lists]

Re: sed syntex in procmailrc question

2011-10-14 07:46:42
Zhiliang <hu(_at_)animalgenome(_dot_)org> 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

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>