(command.CommandList
  children: [
    (command.ShAssignment
      left: <Id.Lit_VarLike 'keep='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'keep='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'keep='> name:keep)
          op: assign_op.Equal
          rhs: {<4>}
        )
      ]
      redirects: []
    )
    (command.ShAssignment
      left: <Id.Lit_VarLike 'totalmsgs='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'totalmsgs='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'totalmsgs='> name:totalmsgs)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (CommandSub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (command.Simple
                          blame_tok: <echo>
                          more_env: []
                          words: [{<echo>} {(SQ <x>)}]
                          redirects: []
                          do_fork: T
                        )
                        (command.Simple
                          blame_tok: <mail>
                          more_env: []
                          words: [{<mail>}]
                          redirects: []
                          do_fork: T
                        )
                        (command.Simple
                          blame_tok: <sed>
                          more_env: []
                          words: [{<sed>} {<-n>} {(SQ <2p>)}]
                          redirects: []
                          do_fork: T
                        )
                        (command.Simple
                          blame_tok: <awk>
                          more_env: []
                          words: [{<awk>} {(SQ <'{print $2}'>)}]
                          redirects: []
                          do_fork: T
                        )
                      ]
                      ops: [<Id.Op_Pipe _> <Id.Op_Pipe _> <Id.Op_Pipe _>]
                    )
                  right: <Id.Eof_RParen _>
                )
              )
            }
        )
      ]
      redirects: []
    )
    (command.If
      if_kw: <Id.KW_If if>
      arms: [
        (IfArm
          keyword: <Id.KW_If if>
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.Simple
                      blame_tok: <Id.Lit_LBracket '['>
                      more_env: []
                      words: [
                        {<Id.Lit_LBracket '['>}
                        {($ Id.VSub_DollarName totalmsgs)}
                        {<-lt>}
                        {($ Id.VSub_DollarName keep)}
                        {<Id.Lit_RBracket ']'>}
                      ]
                      redirects: []
                      do_fork: T
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          then_kw: <Id.KW_Then then>
          action: [(command.ControlFlow keyword:<Id.ControlFlow_Exit exit> arg_word:{<0>})]
          spids: [54 68]
        )
      ]
      else_action: []
      fi_kw: <Id.KW_Fi fi>
      redirects: []
    )
    (command.ShAssignment
      left: <Id.Lit_VarLike 'topmsg='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'topmsg='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'topmsg='> name:topmsg)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (word_part.ArithSub
                  left: <Id.Left_DollarDParen '$(('>
                  anode: 
                    (arith_expr.Binary
                      op_id: Id.Arith_Minus
                      left: {($ Id.VSub_DollarName totalmsgs)}
                      right: {($ Id.VSub_DollarName keep)}
                    )
                  right: <Id.Right_DollarDParen _>
                )
              )
            }
        )
      ]
      redirects: []
    )
    (command.Simple
      blame_tok: <mail>
      more_env: []
      words: [{<mail>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<EOF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [<d1-> ($ Id.VSub_DollarName topmsg) <'\n'> <'q\n'>]
            )
        )
      ]
      do_fork: T
    )
    (command.ControlFlow keyword:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)