I've got a LaTeX file containing
\newcommand{\revision}{value}
And during CI I want to do the following:
REV=${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}
sed -i 's/{\\revision}{\(\w*\)}/\1'"$REV"'/' variables.tex
expecting something along the lines of \newcommand{\revision}{577f813d}
Unfortunately this happens:
> REV=test sed 's/{\\revision}{\(\w*\)}/\1'"$REV"'/' variables.tex
\newcommandvaluetest
Why does this happen?
$REV
and share the result{
s and}
s, and the\revision
string, then adds thetest
string.