(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:agendafile)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$HOME') <'/.agenda'>)}
          spids: [11]
        )
      ]
    )
    (command.ShFunction
      name: checkDate
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:weekday)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [29]
                )
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:day)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [32]
                )
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:month)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$3')}
                  spids: [35]
                )
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:year)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$4')}
                  spids: [38]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:format1)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_DollarName '$weekday'))}
                  spids: [42]
                )
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:format2)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_DollarName '$day') ($ Id.VSub_DollarName '$month'))}
                  spids: [47]
                )
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:format3)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ ($ Id.VSub_DollarName '$day') ($ Id.VSub_DollarName '$month') 
                        ($ Id.VSub_DollarName '$year')
                      )
                    }
                  spids: [53]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:IFS)
                  op: assign_op.Equal
                  rhs: {(DQ <'|'>)}
                  spids: [67]
                )
              ]
            )
            (C {<echo>} {(DQ <'On the agenda for today:'>)})
            (command.WhileUntil
              keyword: <Id.KW_While while>
              cond: 
                (condition.Shell
                  commands: [
                    (command.Sentence
                      child: (C {<read>} {<date>} {<description>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              body: 
                (command.DoGroup
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$date'))} 
                                  {<Id.Lit_Equals '='>} {(DQ ($ Id.VSub_DollarName '$format1'))} {<-o>} {(DQ ($ Id.VSub_DollarName '$date'))} 
                                  {<Id.Lit_Equals '='>} {(DQ ($ Id.VSub_DollarName '$format2'))} {<-o>} {(DQ ($ Id.VSub_DollarName '$date'))} 
                                  {<Id.Lit_Equals '='>} {(DQ ($ Id.VSub_DollarName '$format3'))} {<Id.Lit_RBracket ']'>}
                                )
                              ]
                            )
                          action: [(C {<echo>} {(DQ <'  '> ($ Id.VSub_DollarName '$description'))})]
                          spids: [98 141]
                        )
                      ]
                    )
                  ]
                )
              redirects: [
                (redir
                  op: <Id.Redir_Less '<'>
                  loc: (redir_loc.Fd fd:0)
                  arg: {($ Id.VSub_DollarName '$agendafile')}
                )
              ]
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-e>} 
                      {($ Id.VSub_DollarName '$agendafile')} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [
                {<echo>}
                {(DQ ($ Id.VSub_Number '$0') <': You don\'t seem to have an .agenda file. '>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [{<echo>} {(DQ <'To remedy this, please use \'addagenda\' to add events'>)}]
              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: [164 178]
        )
      ]
    )
    (C {<eval>} 
      {
        (command_sub
          left_token: <Id.Left_DollarParen '$('>
          child: (C {<date>} {(SQ <'+weekday="%a" month="%b" day="%e" year="%G"'>)})
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:day)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<echo>} {($ Id.VSub_DollarName '$day')})
                        (C {<sed>} {(SQ <'s/ //g'>)})
                      ]
                      negated: F
                    )
                )
              )
            }
          spids: [224]
        )
      ]
    )
    (C {<checkDate>} {($ Id.VSub_DollarName '$weekday')} {($ Id.VSub_DollarName '$day')} 
      {($ Id.VSub_DollarName '$month')} {($ Id.VSub_DollarName '$year')}
    )
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)