sed replacing cannot work fine in Makefile on Windows
Closed this issue · 0 comments
pplmx commented
sed not works
Reproduction
# a txt file with \', I want to replace it with ''
# \' => ''
cat << EOF > a.txt
\'
\'
''
""
EOF
# use sed to replace it, this works fine on windows git bash
sed -i "s/\\\'/''/g" a.txt && cat a.txt
# but if this statement in a Makefile, it will not work
cat << EOF > Makefile
replace:
@sed -i "s/\\\'/''/g" a.txt
EOF
# run make command, it did nothing but appending '' to each line
make replace && cat a.txt
\'''
\'''
''''
""''