How do I pass a Python variable to Bash Shell over SSH connection? -


this question has answer here:

i try check file existence on remote server. works fine me, except want pass file path variable.

here _,stdout,_=ssh.exec_command("[ -f d:/tryssh/1.txt ] && echo ok")

and need d:/tryssh/1.txt variable specify in python script used later in bash, this

          `_,stdout,_=ssh.exec_command("[ -f $filepath ] && echo ok")` 

as command string, use string:

file_path = "d:/tryssh/1.txt" command = "[ -f %s ] && echo ok" % file_path _,stdout,_=ssh.exec_command(command) 

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -