Search code examples
pythontelnet

wthin tn.write() are double parentheses


I have bash to run in python code tn.write()

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

when I run it will error

syntax error: `a=$' unexpected

Solution

  • You cannot run python code directly in your bash. You need to do as follows:

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

    You will encounter other errors, but not in the scope of your question.