How do you use " " whe sending a command

  • Thread starter Fernando Armenta
  • Start date
F

Fernando Armenta

Hello,



I am trying to pass the following command



ssh IP_address "ssh IP_address ls"



How you do that in Python?

/" ?

"/ ?



p = os.popen('ssh.exp ' + MGMT_IP + ' ' + /" ssh + PMI_IP_NODE1 + ' ' +
/bin/tdslog -C "/')





Thanks for the help...



-F
 
U

Ulrich Petri

Hello,

I am trying to pass the following command

ssh IP_address "ssh IP_address ls"

How you do that in Python?
/" ?
"/ ?

a = " ' "
b = ' " '
c = """ " ' ''' """
d = ''' " ' """ ''''
p = os.popen('ssh.exp ' + MGMT_IP + ' ' + /" ssh + PMI_IP_NODE1 + ' ' + /bin/tdslog -C "/')
But a imho better way would be:

vars = {'mgmt_ip': '10.0.0.1', 'ip':'10.0.0.2', 'cmd':'/bin/ls'}
command = 'ssh.exp %(mgmt_ip)s "ssh %(ip)s %(cmd)s"' % vars
p = os.popen

HTH

Ciao Ulrich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top