'I want to execute the command with multiple argument on ssh using python
What I tried is to execute :
host=xyz
port = 22
username = xyz_username
ssh_cli = paramiko.SSHClient()
ssh_cli.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_cli.connect(host, port, username, allow_agent=False, timeout=None)
commands = [./BinaryExecutableFile  ./scene00021.bin ./scene00021.json  ./param.txt   ./cluster.json    ./count.json]
                        
for command in commands:
    ssh.client.exec_command(command)
    time.sleep(0.5)
terms
- Binary file:BinaryExecutableFile
- input file:./scene00021.bin output
- output_file:./scene00021.apk
- paramaters file1: ./param.txt
- paramaters file2:./cluster.json
- paramaters file3: ./count.json
Solution 1:[1]
You don't need a loop. There's just one command with multiple arguments. Concatenate them together to make the command line, and execute that.
ssh.client.exec_command(' '.join(commands))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | Barmar | 
