diff --git a/tsshbatch.py b/tsshbatch.py index 36d8a0c..35214f2 100755 --- a/tsshbatch.py +++ b/tsshbatch.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # Non-Interactive ssh Connection -# $Id: tsshbatch.py,v 1.103 2010/12/14 19:19:07 tundra Exp $ +# $Id: tsshbatch.py,v 1.104 2010/12/14 19:31:11 tundra Exp $ import paramiko import sys @@ -48,8 +48,9 @@ # Unpack command line arguments -if len(sys.argv[1:]) == 4: - user, pw, host, cmd = sys.argv[1:] +if len(sys.argv[1:]) >= 4: + user, pw, host = sys.argv[1:4] + cmd = " ".join(sys.argv[4:]) # Otherwise let the user know @@ -69,7 +70,8 @@ ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(host, username=user, password=pw) stdin, stdout, stderr = ssh.exec_command(cmd) - PrintStdout(stdout) + PrintStdout(stdout, TERMINATOR="") + PrintStdout([""]) except: PrintStdout([FAILURE])