When we send command using ssh.exec_command
of Paramiko library of Python. After that we receive three parameter as output: stdin
, stdout
, stderr
. So I want to compare the output of stdout
with existing list. So on what basis the sorting of stdout
result happen if I what to compare it?
If you are referring to commands like ls
, you may get different results based on environment variables set.
And you can get different environments based on whether a terminal is allocated for the session.
With Paramiko SSHClient.exec_command
with the get_pty
parameter with the default value False
, you should get the same results as with:
ssh user@host command
If you set get_pty
to True
, you get the same results as with:
ssh -T user@host command
But you should not set get_pty=True
, as your code can then break when the environment changes.
Related questions with more details: