(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tid)
          op: assign_op.Equal
          rhs: {(DQ <'sftp in chroot'>)}
          spids: [7]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:CHROOT)
          op: assign_op.Equal
          rhs: {<'/var/run'>}
          spids: [13]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:FILENAME)
          op: assign_op.Equal
          rhs: {<testdata_> (${ Id.VSub_Name USER)}
          spids: [16]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:PRIVDATA)
          op: assign_op.Equal
          rhs: {(${ Id.VSub_Name CHROOT) <'/'> (${ Id.VSub_Name FILENAME)}
          spids: [22]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$SUDO'))} {<-a>} 
                      {<Id.KW_Bang '!'>} {<-w>} {<'/var/run'>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} 
              {(DQ <'skipped: need SUDO to create file in /var/run, test won\'t work without'>)}
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          spids: [32 53]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.Pipeline
                      children: [
                        (C {($ Id.VSub_DollarName '$OBJ') <'/check-perm'>} {<-m>} {<chroot>} 
                          {(DQ ($ Id.VSub_DollarName '$CHROOT'))}
                        )
                      ]
                      negated: T
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} 
              {
                (DQ <'skipped: '> ($ Id.VSub_DollarName '$CHROOT') 
                  <' is unsuitable as ChrootDirectory'>
                )
              }
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          spids: [70 87]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {($ Id.VSub_DollarName '$SUDO')} {<sh>} {<-c>} 
          {(DQ <'echo mekmitastdigoat > '> ($ Id.VSub_DollarName '$PRIVDATA'))}
        )
        (C {<fatal>} {(DQ <'create '> ($ Id.VSub_DollarName '$PRIVDATA') <' failed'>)})
      ]
    )
    (C {<start_sshd>} {<-oChrootDirectory> <Id.Lit_Equals '='> ($ Id.VSub_DollarName '$CHROOT')} 
      {<-oForceCommand> <Id.Lit_Equals '='> (DQ <'internal-sftp -d /'>)}
    )
    (C {<verbose>} {(DQ <'test '> ($ Id.VSub_DollarName '$tid') <': get'>)})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Simple
          words: [
            {(${ Id.VSub_Name SFTP)}
            {<-S>}
            {(DQ ($ Id.VSub_DollarName '$SSH'))}
            {<-F>}
            {($ Id.VSub_DollarName '$OBJ') <'/ssh_config'>}
            {<host> <Id.Lit_Colon ':'> <'/'> (${ Id.VSub_Name FILENAME)}
            {($ Id.VSub_DollarName '$COPY')}
          ]
          redirects: [
            (redir
              op: <Id.Redir_DGreat '>>'>
              loc: (redir_loc.Fd fd:1)
              arg: {($ Id.VSub_DollarName '$TEST_REGRESS_LOGFILE')}
            )
            (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
          ]
          do_fork: T
        )
        (C {<fatal>} {(DQ <'Fetch '> (${ Id.VSub_Name FILENAME) <' failed'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<cmp>} {($ Id.VSub_DollarName '$PRIVDATA')} {($ Id.VSub_DollarName '$COPY')})
        (C {<fail>} 
          {(DQ ($ Id.VSub_DollarName '$PRIVDATA') <' '> ($ Id.VSub_DollarName '$COPY') <' differ'>)}
        )
      ]
    )
    (C {($ Id.VSub_DollarName '$SUDO')} {<rm>} {($ Id.VSub_DollarName '$PRIVDATA')})
  ]
)