Why is the escaping of double quotes are lost in this case?
$ cat foo.txt
This is a "very good" text worth AMOUNT dollars
$ cat full_story.txt
This is about money:
STORY
Testing it with the following:
VAR=$(cat foo.txt)
TOTAL=$(cat full_story.txt)
echo "$TOTAL" | perl -pe "s/STORY/$VAR/g"
Result:
This is about money:
This is a "very good" text worth AMOUNT dollars
The escape of double quotes got lost. I was expecting:
This is about money:
This is a "very good" text worth AMOUNT dollars
How can I preserve the escapes?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…