14 Oct 2011 14:46
Re: sed syntex in procmailrc question
Harry Putnam <reader <at> newsguy.com>
2011-10-14 12:46:06 GMT
2011-10-14 12:46:06 GMT
Zhiliang <hu <at> animalgenome.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
RSS Feed