diff --git a/tsshbatch.py b/tsshbatch.py index 11c3d1d..b32a159 100755 --- a/tsshbatch.py +++ b/tsshbatch.py @@ -20,7 +20,7 @@ CMDINCL = PROGENV + "CMDS" HOSTINCL = PROGENV + "HOSTS" -CVSID = "$Id: tsshbatch.py,v 1.189 2014/11/25 23:51:40 tundra Exp $" +CVSID = "$Id: tsshbatch.py,v 1.190 2014/11/28 18:07:20 tundra Exp $" VERSION = CVSID.split()[2] CPRT = "(c)" DATE = "2011-2014" @@ -359,14 +359,14 @@ # If this is a sudo run, force password to be read # from stdin thereby avoiding fiddling around with ptys. - if command.startswith(SUDO + " "): + if command.count(SUDO + " ") > 0: command = command.replace(SUDO, "%s %s" % (SUDO, SUDOARGS), 1) stdin, stdout, stderr = ssh.exec_command(command) # If doing a sudo command, send the password - if command.startswith(SUDO + " "): + if command.count(SUDO + " ") > 0: stdin.write("%s\n" % sudopw) stdin.flush() @@ -780,7 +780,7 @@ SUDOPRESENT = False for command in Commands: - if command.startswith(SUDO + " "): + if command.count(SUDO + " ") > 0: SUDOPRESENT = True # Check condition 1) above.