I'm working on a python script that ssh
into a server and read some file contents. Let's say they are file1.txt, file2.txt and file3.txt.
For now I'm doing
commands = "ssh {host} {port}; cat file1.txt; cat file2.txt; cat file3.txt"
p = subprocess.run(commands, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
But this gives contents of three files concatenated. Is there some way that I can redirect each command's output to different pipe, so that I can easily distinguish which output came from which file?