Answer the question
In order to leave comments, you need to log in
How to insert a variable into a command?
Paramiko module, I want to create a TEST file on a remote server that will contain the current date:
(TEST20180331)
import paramiko
import datatime
a = datetime.datetime.today().strftime("%Y%m%d") ###текущая дата
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('10.12.123.123', port=22, username='sshuser, password='123')
sftp = ssh.open_sftp()
stdin, stdout, stderr = ssh.exec_command ('touch /export/home/TEST???) ###В bash я бы просто написал TEST$a
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question