How do you use " " whe sending a command

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fernando Armenta

    How do you use " " whe sending a command

    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.e xp ' + MGMT_IP + ' ' + /" ssh + PMI_IP_NODE1 + ' ' +
    /bin/tdslog -C "/')





    Thanks for the help...



    -F




  • Gordon Airport

    #2
    Re: How do you use " " whe sending a command

    So close:

    \"
    or \' in a '' string.

    Comment

    • Ulrich Petri

      #3
      Re: How do you use " " whe sending a command

      [color=blue]
      > "Fernando Armenta" <farmenta@pilla rdata.com> schrieb im Newsbeitrag[/color]
      news:mailman.10 64965743.15057. python-list@python.org ...[color=blue]
      > Hello,
      >
      > I am trying to pass the following command
      >
      > ssh IP_address "ssh IP_address ls"
      >
      > How you do that in Python?
      > /" ?
      > "/ ?[/color]

      a = " ' "
      b = ' " '
      c = """ " ' ''' """
      d = ''' " ' """ ''''
      [color=blue]
      > p = os.popen('ssh.e xp ' + MGMT_IP + ' ' + /" ssh + PMI_IP_NODE1 + ' ' +[/color]
      /bin/tdslog -C "/')[color=blue]
      >[/color]
      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


      Comment

      Working...