sed="sed 's/mon.tex/"$1$tex"/g'"
Which creates a variable sedcontaining a string sed 's/mon.text/foo.tex/g', assuming it $1is foofor example.
Then you expand $sedwithout quotes and become
sed ''\''s/mon.tex/foo.tex/g'\'''
Which includes the literal 'at the beginning of your expression, as if you said:
sed -e \''s
EDIT: I repeat, your problem is that you are unnecessarily quoting an expression sedinside a variable's destination. Use
sed="sed s/mon.tex/$1$tex/g Makefile > Makefile"
And it will work as expected.
source
share