Syntax Error, Text Style and escaping characters

I have a weird error (I guess it could be called a bug), where a file containing the text line (as in in a cell you create with Alt-7) gives a syntax error when called from the terminal using

math -run "<<file.wl"


(It does not give any errors when run from the graphical interface).

This is surprising as I did not expect this kind of cell to be run at all. In fact the file in question contains many of such cells which never caused any problem. The offending text seems to be

sed -i -E "s/StringJoin$(.*),.*$/\1/" file


I can also not reliably put this in a comment since it contains *). What would be a good way to keep such a comment in some form where it is sure to not be evaluated. (Preferably in some readable form so without escaping/changing the string above itself.) Is this at all possible?