#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    SSH commands in Python Script


    Hello All
    I am writing a script will execute the ssh commands . For arguments , I am passing the Ip address of the client and the identity file
    The script syntax is
    ./rtnssh.py -stbaddr<STBIP/STBMAC> -i Identity file

    Wanted to know , how I can i have a passthru to the ssh command , if I add additional arguments in the above script
    eg .If I pass "-X " option in the script
    ./rtnssh.py -stbaddr<STB/IP/STBMAC> -X
    it should internally execute the command
    ssh -X STBIP -i identity file
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,899
    Rep Power
    481
    def compute_command_string(arguments):
    # statements to make the command string
    # return hairy_command_string

    command = compute_command_string(*args,**kwargs)
    os.system(command)
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo