(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tid)
          op: assign_op.Equal
          rhs: {(DQ <'sftp invalid commands'>)}
          spids: [7]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DATA2)
          op: assign_op.Equal
          rhs: {<'/bin/sh'> (${ Id.VSub_Name EXEEXT)}
          spids: [13]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:NONEXIST)
          op: assign_op.Equal
          rhs: {<'/NONEXIST.'> ($ Id.VSub_Dollar '$$')}
          spids: [19]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GLOBFILES)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                child: 
                  (command.Subshell
                    child: 
                      (command.CommandList
                        children: [
                          (command.Sentence
                            child: (C {<cd>} {<'/bin'>})
                            terminator: <Id.Op_Semi _>
                          )
                          (C {<echo>} {<l> <Id.Lit_Star '*'>})
                        ]
                      )
                  )
              )
            }
          spids: [23]
        )
      ]
    )
    (C {<rm>} {<-rf>} {(${ Id.VSub_Name COPY)} {(${ Id.VSub_Name COPY) <.1>} {(${ Id.VSub_Name COPY) <.2>} 
      {(${ Id.VSub_Name COPY) <.dd>}
    )
    (C {<rm>} {<-f>} {(${ Id.VSub_Name COPY)})
    (C {<verbose>} {(DQ ($ Id.VSub_DollarName '$tid') <': get nonexistent'>)})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Pipeline
          children: [
            (C {<echo>} 
              {(DQ <'get '> ($ Id.VSub_DollarName '$NONEXIST') <' '> ($ Id.VSub_DollarName '$COPY'))}
            )
            (command.Simple
              words: [{(${ Id.VSub_Name SFTP)} {<-D>} {(${ Id.VSub_Name SFTPSERVER)}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
                (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
              ]
              do_fork: T
            )
          ]
          negated: F
        )
        (C {<fail>} {(DQ <'get nonexistent failed'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (C {<test>} {<-f>} {(${ Id.VSub_Name COPY)})
        (C {<fail>} {(DQ <'existing copy after get nonexistent'>)})
      ]
    )
    (C {<rm>} {<-f>} {(${ Id.VSub_Name COPY) <'.dd/'> <Id.Lit_Star '*'>})
    (C {<verbose>} {(DQ ($ Id.VSub_DollarName '$tid') <': glob get to nonexistent directory'>)})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Pipeline
          children: [
            (C {<echo>} {(DQ <'get /bin/l* '> ($ Id.VSub_DollarName '$NONEXIST'))})
            (command.Simple
              words: [{(${ Id.VSub_Name SFTP)} {<-D>} {(${ Id.VSub_Name SFTPSERVER)}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
                (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
              ]
              do_fork: T
            )
          ]
          negated: F
        )
        (C {<fail>} {(DQ <'get nonexistent failed'>)})
      ]
    )
    (command.ForEach
      iter_name: x
      iter_words: [{($ Id.VSub_DollarName '$GLOBFILES')}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<test>} {<-f>} {(${ Id.VSub_Name COPY) <'.dd/'> ($ Id.VSub_DollarName '$x')})
                (C {<fail>} {(DQ <'existing copy after get nonexistent'>)})
              ]
            )
          ]
        )
    )
    (C {<rm>} {<-f>} {(${ Id.VSub_Name COPY)})
    (C {<verbose>} {(DQ ($ Id.VSub_DollarName '$tid') <': put nonexistent'>)})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Pipeline
          children: [
            (C {<echo>} 
              {(DQ <'put '> ($ Id.VSub_DollarName '$NONEXIST') <' '> ($ Id.VSub_DollarName '$COPY'))}
            )
            (command.Simple
              words: [{(${ Id.VSub_Name SFTP)} {<-D>} {(${ Id.VSub_Name SFTPSERVER)}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
                (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
              ]
              do_fork: T
            )
          ]
          negated: F
        )
        (C {<fail>} {(DQ <'put nonexistent failed'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (C {<test>} {<-f>} {(${ Id.VSub_Name COPY)})
        (C {<fail>} {(DQ <'existing copy after put nonexistent'>)})
      ]
    )
    (C {<rm>} {<-f>} {(${ Id.VSub_Name COPY) <'.dd/'> <Id.Lit_Star '*'>})
    (C {<verbose>} {(DQ ($ Id.VSub_DollarName '$tid') <': glob put to nonexistent directory'>)})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Pipeline
          children: [
            (C {<echo>} {(DQ <'put /bin/l* '> (${ Id.VSub_Name COPY) <.dd>)})
            (command.Simple
              words: [{(${ Id.VSub_Name SFTP)} {<-D>} {(${ Id.VSub_Name SFTPSERVER)}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
                (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
              ]
              do_fork: T
            )
          ]
          negated: F
        )
        (C {<fail>} {(DQ <'put nonexistent failed'>)})
      ]
    )
    (command.ForEach
      iter_name: x
      iter_words: [{($ Id.VSub_DollarName '$GLOBFILES')}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<test>} {<-f>} {(${ Id.VSub_Name COPY) <'.dd/'> ($ Id.VSub_DollarName '$x')})
                (C {<fail>} {(DQ <'existing copy after nonexistent'>)})
              ]
            )
          ]
        )
    )
    (C {<rm>} {<-f>} {(${ Id.VSub_Name COPY)})
    (C {<verbose>} {(DQ ($ Id.VSub_DollarName '$tid') <': rename nonexistent'>)})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Pipeline
          children: [
            (C {<echo>} 
              {(DQ <'rename '> ($ Id.VSub_DollarName '$NONEXIST') <' '> (${ Id.VSub_Name COPY) <.1>)}
            )
            (command.Simple
              words: [{(${ Id.VSub_Name SFTP)} {<-D>} {(${ Id.VSub_Name SFTPSERVER)}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
                (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
              ]
              do_fork: T
            )
          ]
          negated: F
        )
        (C {<fail>} {(DQ <'rename nonexist failed'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (C {<test>} {<-f>} {(${ Id.VSub_Name COPY) <.1>})
        (C {<fail>} {(DQ <'file exists after rename nonexistent'>)})
      ]
    )
    (C {<rm>} {<-rf>} {(${ Id.VSub_Name COPY)} {(${ Id.VSub_Name COPY) <.dd>})
    (C {<cp>} {($ Id.VSub_DollarName '$DATA')} {($ Id.VSub_DollarName '$COPY')})
    (C {<mkdir>} {(${ Id.VSub_Name COPY) <.dd>})
    (C {<verbose>} {(DQ ($ Id.VSub_DollarName '$tid') <': rename target exists (directory)'>)})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Pipeline
          children: [
            (C {<echo>} 
              {(DQ <'rename '> ($ Id.VSub_DollarName '$COPY') <' '> (${ Id.VSub_Name COPY) <.dd>)}
            )
            (command.Simple
              words: [{(${ Id.VSub_Name SFTP)} {<-D>} {(${ Id.VSub_Name SFTPSERVER)}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
                (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
              ]
              do_fork: T
            )
          ]
          negated: F
        )
        (C {<fail>} {(DQ <'rename target exists (directory) failed'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<test>} {<-f>} {(${ Id.VSub_Name COPY)})
        (C {<fail>} {(DQ <'oldname missing after rename target exists (directory)'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<test>} {<-d>} {(${ Id.VSub_Name COPY) <.dd>})
        (C {<fail>} {(DQ <'newname missing after rename target exists (directory)'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Simple
          words: [{<cmp>} {($ Id.VSub_DollarName '$DATA')} {(${ Id.VSub_Name COPY)}]
          redirects: [
            (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})
            (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
          ]
          do_fork: T
        )
        (C {<fail>} {(DQ <'corrupted oldname after rename target exists (directory)'>)})
      ]
    )
    (C {<rm>} {<-f>} {(${ Id.VSub_Name COPY) <'.dd/'> <Id.Lit_Star '*'>})
    (C {<rm>} {<-rf>} {(${ Id.VSub_Name COPY)})
    (C {<cp>} {(${ Id.VSub_Name DATA2)} {(${ Id.VSub_Name COPY)})
    (C {<verbose>} {(DQ ($ Id.VSub_DollarName '$tid') <': glob put files to local file'>)})
    (command.Pipeline
      children: [
        (C {<echo>} {(DQ <'put /bin/l* '> ($ Id.VSub_DollarName '$COPY'))})
        (command.Simple
          words: [{(${ Id.VSub_Name SFTP)} {<-D>} {(${ Id.VSub_Name SFTPSERVER)}]
          redirects: [
            (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})
            (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
          ]
          do_fork: T
        )
      ]
      negated: F
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<cmp>} {(${ Id.VSub_Name DATA2)} {(${ Id.VSub_Name COPY)})
        (C {<fail>} {(DQ <'put successed when it should have failed'>)})
      ]
    )
    (C {<rm>} {<-rf>} {(${ Id.VSub_Name COPY)} {(${ Id.VSub_Name COPY) <.1>} {(${ Id.VSub_Name COPY) <.2>} 
      {(${ Id.VSub_Name COPY) <.dd>}
    )
  ]
)