I am connecting to a remote host via SSH using paramiko
and running some simple commands like cd
. In the second command, i need to pass an argument as shown in the sample below:
import paramiko
import os
import shutil
import datetime
import socket
X='ABCDF12'
p=paramiko.SSHClient()
p.set_missing_host_key_policy(paramiko.AutoAddPolicy())
p.connect("example.com",username="tatta",password="abcy1")
print(socket.gethostname())
stdin, stdout, stderr = p.exec_command("cd /bca/scripts;touch $X")
opt = stdout.readlines()
opt = "".join(opt)
print(opt)
Expected : ABCDF12
Actual : touch command not working