Bart Schaefer <barton(_dot_)schaefer(_at_)gmail(_dot_)com> writes:
To expand just a little on Harry's correct explanation:
In the literal example you included, the single quotes around
's/SUBJET/' are unnecessary. You only need quotes to protect spaces,
dollar signs, and globbing characters like *?[].
However, my guess is that your real sed expression, which you have not
shown us, doesn't have the string SUBJET but instead has a complex
string that might contain some of those special characters that need
quoting.
In that case for clarity I might have written such an expression as
sed -e s/'The Real String Goes Here'/"$SUBJ"/g
rather than butting the two sets of quotes up against each other.
Again no expert here but let me move off sed for a moment since I'm
more familiar with awk. Aren't there cases with awk where spaces are
not the issue but allowing a shell Variable to expand are what
matters?
For example if you have a variable say, in the environment. And you
want it to expand inside some awk code in .procmailrc. Wouldn't you
need to do something like awk '/somestring/{print $0"'$MY_ENV_VAR'"}'
Where in effect you are stopping the awk code to allow the expansion
and then taking it up again.
I realize there are other constructs that would serve the same purpose
and avoid quoting quagmires like:
awk -v var=$MY_ENV_VAR '{print var}'
But I'm just thinking there are usages where single quotes are used
for something besides spaces.
____________________________________________________________
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