diff --git a/tsshbatch.py b/tsshbatch.py index 3352384..99c055e 100755 --- a/tsshbatch.py +++ b/tsshbatch.py @@ -20,7 +20,7 @@ CMDINCL = PROGENV + "CMDS" HOSTINCL = PROGENV + "HOSTS" -CVSID = "$Id: tsshbatch.py,v 1.207 2014/12/09 15:16:12 tundra Exp $" +CVSID = "$Id: tsshbatch.py,v 1.208 2014/12/09 16:48:21 tundra Exp $" VERSION = CVSID.split()[2] CPRT = "(c)" PROGDATE = "2011-2014" @@ -67,6 +67,8 @@ COMMANDS = 'Commands' CONSUCCESS = 'SUCCESS: Connection Established' EXECUTE = '!' +FILEGET = '-G' +FILEPUT = '-P' GETFILES = 'Files To GET' HOSTSEP = '-' HOSTNOISE = '[%s]' @@ -77,6 +79,8 @@ PATHDELIM = ':' PATHSEP = os.sep PUTFILES = 'Files To PUT' +QUOTED = '"' +QUOTES = "'" SEPARATOR = ' ---> ' STDIN = '-' SUDO = 'sudo' @@ -569,6 +573,7 @@ else: FileIncludeStack.append(filename) # Push it on to the stack history + # Line parsing starts here try: f = open(filename) @@ -578,9 +583,19 @@ line = ConditionLine(line) + # Process file transfer requests + + if line.startswith(FILEGET): + val = line.replace(QUOTED, '').replace(QUOTES, '').split(FILEGET)[1].strip() + ProcessTXRQ(val, Get_Transfer_List) + + elif line.startswith(FILEPUT): + val = line.replace(QUOTED, '').replace(QUOTES, '').split(FILEPUT)[1].strip() + ProcessTXRQ(val, Put_Transfer_List) + # Process variable definitions - if line.startswith(DEFINE): + elif line.startswith(DEFINE): line = line.split(DEFINE)[1] if line.count(ASSIGN) == 0: @@ -716,7 +731,7 @@ if opt == "-K": KEYEXCHANGE = False - if opt == "-G": + if opt == FILEGET: ProcessTXRQ(val, Get_Transfer_List) if opt == "-H": @@ -726,7 +741,7 @@ PROMPTUSERNAME = True KEYEXCHANGE = False - if opt == "-P": + if opt == FILEPUT: ProcessTXRQ(val, Put_Transfer_List) if opt == "-S":