Here is my script:
openscad $1 -D generate=1 -o $1.csg 2>&1 >/dev/null |
sed 's/ECHO: \"\[LC\] //' |
sed 's/"$//' |
sed '$a;' >./2d_$1
That output:
sed: 1: "$a;": command a expects \ followed by text
Here is my script:
openscad $1 -D generate=1 -o $1.csg 2>&1 >/dev/null |
sed 's/ECHO: \"\[LC\] //' |
sed 's/"$//' |
sed '$a;' >./2d_$1
That output:
sed: 1: "$a;": command a expects \ followed by text
 
    
    Your version of sed is not GNU sed which allows what you use.  You need to write:
openscad $1 -D generate=1 -o $1.csg 2>&1 >/dev/null |
sed 's/ECHO: \"\[LC\] //' |
sed 's/"$//' |
sed '$a\
;' >./2d_$1
Also, three copies of sed is a little excessive (to be polite); one suffices:
openscad $1 -D generate=1 -o $1.csg 2>&1 >/dev/null |
sed -e 's/ECHO: \"\[LC\] //' \
    -e 's/"$//' \
    -e '$a\' \
    -e ';' >./2d_$1
or:
openscad $1 -D generate=1 -o $1.csg 2>&1 >/dev/null |
sed -e 's/ECHO: \"\[LC\] //' -e 's/"$//' -e '$a\' -e ';' >./2d_$1
 
    
    On MacOS, the following works when trying to use command 'a'
sed '/REGEX/a \
    HELLO_WORLD \
    HOW_ARE_YOU \
' <filePath>
