I'm using eclipse on Windows to build a C-project.
I create a preprocessor define containing git status summary git status -s.
This is my define symbol:
GIT_STATUS="$(shell git status -s)"
This works, but if changed files contain spaces those paths are surrounded by un-escaped quotes.
example:
git status -s
M file1.c
M "file 2.c"
expected output:
'-DGIT_STATUS="M file1.c \"file 2.c\""'
In the command-line I can use sed to escape these quotes:
git status -s | sed 's/"/\\"/g'
or
git status -s | sed 's/\x22/\\"/g'
This works. But if I use this in define symbol it doesn't work.
I can replace characters such as a and b:
GIT_STATUS="$(shell git status -s | sed "s/a/b/g")"
But if I add a double quote it won't work. Even if I escape it once or twice or three times.
I either get sed: bad option in substitution expression or an empty string as value for the define.
So now I use a separate file as a workaround:
GIT_STATUS="$(shell git status -s | sed -f ../replace_quotes.sed)"
containing:
s/"/\\\"/g
This works, but I'm looking for a way to do it in one line without an extra file.
I don't know how to debug the intermediate outputs of this process so I don't know what escaped characters are eaten at each step.

GIT_STATUS="$(var='s/"/\\\"/g' ; sed -f <(echo $var) <(shell git status -s))"GIT_STATUSas amakevariable, or maybe a shell variable. What does this have to do with C or the C preprocessor? Or with Eclipse?