(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:timestamp) op: assign_op.Equal rhs: {(DQ <.timestamp>)} spids: [14] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tempfile) op: assign_op.Equal rhs: {(DQ <'/tmp/sftpsync.'> ($ Id.VSub_Dollar '$$'))} spids: [19] ) ] ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:count) op:assign_op.Equal rhs:{<0>} spids:[25])] ) (C {<trap>} { (DQ (command_sub left_token:<Id.Left_Backtick '`'> child:(C {<which>} {<rm>})) <' -f '> ($ Id.VSub_DollarName '$tempfile') ) } {<0>} {<1>} {<15>} ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [{<echo>} {(DQ <'Usage: '> ($ Id.VSub_Number '$0') <' user@host { remotedir }'>)}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [53 67] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:user) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_Number '$1')}) (C {<cut>} {<-d> <Id.Lit_At '@'>} {<-f1>}) ] negated: F ) ) ) } spids: [89] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:server) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_Number '$1')}) (C {<cut>} {<-d> <Id.Lit_At '@'>} {<-f2>}) ] negated: F ) ) ) } spids: [107] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-gt>} {<1>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [{<echo>} {(DQ <'cd '> ($ Id.VSub_Number '$2'))}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$tempfile')} ) ] do_fork: T ) ] spids: [126 140] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-f>} {($ Id.VSub_DollarName '$timestamp')} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ForEach iter_name: filename iter_words: [{<Id.Lit_Star '*'>}] do_arg_iter: F body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ ($ Id.VSub_DollarName '$filename'))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<echo>} { (DQ <'put -P '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) ($ Id.VSub_DollarName '$filename') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ) } ] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$tempfile')} ) ] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:count) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName '$count')} right: {<Id.Lit_Digits 1>} ) ) } spids: [222] ) ] ) ] spids: [191 205] ) ] ) ] ) ) ] spids: [157 171] ) ] else_action: [ (command.ForEach iter_name: filename iter_words: [ { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<find>} {<.>} {<-newer>} {($ Id.VSub_DollarName '$timestamp')} {<-type>} {<f>} {<-print>} ) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (command.Simple words: [ {<echo>} { (DQ <'put -P '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$filename') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ) } ] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$tempfile')} ) ] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:count) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName '$count')} right: {<Id.Lit_Digits 1>} ) ) } spids: [284] ) ] ) ] ) ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$count')} {<-eq>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<echo>} { (DQ ($ Id.VSub_Number '$0') <': No files require uploading to '> ($ Id.VSub_DollarName '$server') ) } ] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [302 316] ) ] ) (command.Simple words: [{<echo>} {(DQ <quit>)}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$tempfile')} ) ] do_fork: T ) (C {<echo>} { (DQ <'Synchronizing: Found '> ($ Id.VSub_DollarName '$count') <' files in local folder to upload.'> ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (C {<sftp>} {<-b>} {($ Id.VSub_DollarName '$tempfile')} {(DQ ($ Id.VSub_DollarName '$user') <'@'> ($ Id.VSub_DollarName '$server'))} ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} {(DQ <'Done. All files synchronized up with '> ($ Id.VSub_DollarName '$server'))} ) (C {<touch>} {($ Id.VSub_DollarName '$timestamp')}) ] spids: [358 376] ) ] ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] )