shell 双引号问题

finalcmd =           string(" timeout 3 /bin/sh -c")
                        + string(" \" ( export TERM=dumb && cd ") + lastpath
                        + string(" && ") + command
                        + string(" && echo -n MYPWD= && pwd ) 2>&1")
                        + string(" | iconv -c -s -f utf-8 -t gb2312 \" 2>&1");

popen(finalcmd.c_str(), "r");

当command = echo " '{(}'){{'’\"}} ", 

会报错误:sh: 1: Syntax error: ")" unexpected

但在管道里重定向错误,也无法捕获到这个错误。

请教怎么修改finalcmd?