tn.write() 内是双括号

wthin tn.write() are double parentheses

我在 python 代码 tn.write()

中有 bash 到 运行
tn.write("a=$(lr 2>logp.txt) \n")

当我运行时它会出错

syntax error: `a=$' unexpected

您不能 运行 python 直接在 bash 中编码。 您需要做如下操作:

python -c 'tn.write("a=$(lr 2>logp.txt) \n")'

你还会遇到其他错误,但不在你的问题范围内。