The problem is that bash runs the two commands, captures their outputs, and then substitutes that to produce TESTVAR=1 2
. That assigns 1 to TESTVAR and tries to run 2. Apparently, there's no executable called "2" on my PATH.
The second attempt with quotes came close, but the quotes don't belong to the individual substiturions. You need a single pair:
TESTVAR="$(echo 1) $(echo 2)"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…