(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:logdir)
          op: assign_op.Equal
          rhs: {(DQ <'/var/log'>)}
          spids: [31]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:config)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$logdir') <'/rotatelogs.conf'>)}
          spids: [39]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:mv)
          op: assign_op.Equal
          rhs: {(DQ <'/bin/mv'>)}
          spids: [45]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:default_duration)
          op: assign_op.Equal
          rhs: {<7>}
          spids: [50]
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:count) op:assign_op.Equal rhs:{<0>} spids:[56])]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:duration)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$default_duration')}
          spids: [60]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-f>} 
                      {($ Id.VSub_DollarName '$config')} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {<echo>}
                    {(DQ ($ Id.VSub_Number '$0') <': no config file found. Can\'t proceed.'>)}
                  ]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  do_fork: T
                )
              terminator: <Id.Op_Semi _>
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [64 78]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-w>} 
                      {($ Id.VSub_DollarName '$logdir')} {<-o>} {<Id.KW_Bang '!'>} {<-x>} {($ Id.VSub_DollarName '$logdir')} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ ($ Id.VSub_Number '$0') <': you don\'t have the appropriate permissions in '> 
                    ($ Id.VSub_DollarName '$logdir')
                  )
                }
              ]
              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: [111 133]
        )
      ]
    )
    (C {<cd>} {($ Id.VSub_DollarName '$logdir')})
    (command.ForEach
      iter_name: name
      iter_words: [
        {
          (command_sub
            left_token: <Id.Left_DollarParen '$('>
            child: 
              (command.Pipeline
                children: [
                  (C {<find>} {<.>} {<-maxdepth>} {<1>} {<-type>} {<f>} {<-size>} {<Id.Lit_Other '+'> <0c>} 
                    {<Id.KW_Bang '!'>} {<-name>} {(SQ <'*[0-9]*'>)} {<Id.KW_Bang '!'>} {<-name>} {(SQ <'\\.*'>)} {<Id.KW_Bang '!'>} {<-name>} 
                    {(SQ <'*conf'>)} {<-print>}
                  )
                  (C {<sed>} {(SQ <'s/^\\.\\///'>)})
                ]
                negated: F
              )
          )
        }
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (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: [250]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:duration)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: 
                            (command.Pipeline
                              children: [
                                (C {<grep>} {(DQ <'^'> (${ Id.VSub_Name name) <'='>)} 
                                  {($ Id.VSub_DollarName '$config')}
                                )
                                (C {<cut>} {<-d> <Id.Lit_Equals '='>} {<-f2>})
                              ]
                              negated: F
                            )
                        )
                      )
                    }
                  spids: [269]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$duration'))} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:duration)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$default_duration')}
                          spids: [314]
                        )
                      ]
                    )
                  ]
                  spids: [296 310]
                )
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$duration'))} 
                              {<Id.Lit_Equals '='>} {(DQ <0>)} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} 
                      {(DQ <'Duration set to zero: skipping '> ($ Id.VSub_DollarName '$name'))}
                    )
                    (command.ControlFlow token:<Id.ControlFlow_Continue continue>)
                  ]
                  spids: [321 339]
                )
              ]
            )
            (command.Sentence
              child: 
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:back1)
                      op: assign_op.Equal
                      rhs: {(DQ (${ Id.VSub_Name name) <.1>)}
                      spids: [362]
                    )
                  ]
                )
              terminator: <Id.Op_Semi _>
            )
            (command.Sentence
              child: 
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:back2)
                      op: assign_op.Equal
                      rhs: {(DQ (${ Id.VSub_Name name) <.2>)}
                      spids: [371]
                    )
                  ]
                )
              terminator: <Id.Op_Semi _>
            )
            (command.Sentence
              child: 
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:back3)
                      op: assign_op.Equal
                      rhs: {(DQ (${ Id.VSub_Name name) <.3>)}
                      spids: [381]
                    )
                  ]
                )
              terminator: <Id.Op_Semi _>
            )
            (command.Sentence
              child: 
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:back4)
                      op: assign_op.Equal
                      rhs: {(DQ (${ Id.VSub_Name name) <.4>)}
                      spids: [390]
                    )
                  ]
                )
              terminator: <Id.Op_Semi _>
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ ($ Id.VSub_DollarName '$back1'))} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (C {<Id.Lit_LBracket '['>} {<-z>} 
                                  {
                                    (DQ 
                                      (command_sub
                                        left_token: <Id.Left_DollarParen '$('>
                                        child: 
                                          (command.Simple
                                            words: [
                                              {<find>}
                                              {
                                                (word_part.EscapedLiteral
                                                  token: <Id.Lit_EscapedChar '\\"'>
                                                ) ($ Id.VSub_DollarName '$back1') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>)
                                              }
                                              {<-mtime>}
                                              {<Id.Lit_Other '+'> ($ Id.VSub_DollarName '$duration')}
                                              {<-print>}
                                            ]
                                            redirects: [
                                              (redir
                                                op: <Id.Redir_Great '2>'>
                                                loc: (redir_loc.Fd fd:2)
                                                arg: {<'/dev/null'>}
                                              )
                                            ]
                                            do_fork: T
                                          )
                                      )
                                    )
                                  } {<Id.Lit_RBracket ']'>}
                                )
                              ]
                            )
                          action: [
                            (C {<echo>} {<-n>} 
                              {
                                (DQ ($ Id.VSub_DollarName '$name') 
                                  <'\'s most recent backup is more recent than '> ($ Id.VSub_DollarName '$duration') <' '>
                                )
                              }
                            )
                            (command.Sentence
                              child: (C {<echo>} {(DQ <'days: skipping'>)})
                              terminator: <Id.Op_Semi _>
                            )
                            (command.ControlFlow
                              token: <Id.ControlFlow_Continue continue>
                            )
                          ]
                          spids: [431 461]
                        )
                      ]
                    )
                  ]
                  spids: [414 428]
                )
              ]
            )
            (C {<echo>} 
              {
                (DQ <'Rotating log '> ($ Id.VSub_DollarName '$name') <' (using a '> 
                  ($ Id.VSub_DollarName '$duration') <' day schedule)'>
                )
              }
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ ($ Id.VSub_DollarName '$back3'))} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Sentence
                      child: 
                        (C {<echo>} 
                          {
                            (DQ <'... '> ($ Id.VSub_DollarName '$back3') <' -> '> 
                              ($ Id.VSub_DollarName '$back4')
                            )
                          }
                        )
                      terminator: <Id.Op_Semi _>
                    )
                    (C {($ Id.VSub_DollarName '$mv')} {<-f>} {(DQ ($ Id.VSub_DollarName '$back3'))} 
                      {(DQ ($ Id.VSub_DollarName '$back4'))}
                    )
                  ]
                  spids: [515 529]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ ($ Id.VSub_DollarName '$back2'))} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Sentence
                      child: 
                        (C {<echo>} 
                          {
                            (DQ <'... '> ($ Id.VSub_DollarName '$back2') <' -> '> 
                              ($ Id.VSub_DollarName '$back3')
                            )
                          }
                        )
                      terminator: <Id.Op_Semi _>
                    )
                    (C {($ Id.VSub_DollarName '$mv')} {<-f>} {(DQ ($ Id.VSub_DollarName '$back2'))} 
                      {(DQ ($ Id.VSub_DollarName '$back3'))}
                    )
                  ]
                  spids: [559 573]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ ($ Id.VSub_DollarName '$back1'))} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Sentence
                      child: 
                        (C {<echo>} 
                          {
                            (DQ <'... '> ($ Id.VSub_DollarName '$back1') <' -> '> 
                              ($ Id.VSub_DollarName '$back2')
                            )
                          }
                        )
                      terminator: <Id.Op_Semi _>
                    )
                    (C {($ Id.VSub_DollarName '$mv')} {<-f>} {(DQ ($ Id.VSub_DollarName '$back1'))} 
                      {(DQ ($ Id.VSub_DollarName '$back2'))}
                    )
                  ]
                  spids: [603 617]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<-f>} {(DQ ($ Id.VSub_DollarName '$name'))} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Sentence
                      child: 
                        (C {<echo>} 
                          {
                            (DQ <'... '> ($ Id.VSub_DollarName '$name') <' -> '> 
                              ($ Id.VSub_DollarName '$back1')
                            )
                          }
                        )
                      terminator: <Id.Op_Semi _>
                    )
                    (C {($ Id.VSub_DollarName '$mv')} {<-f>} {(DQ ($ Id.VSub_DollarName '$name'))} 
                      {(DQ ($ Id.VSub_DollarName '$back1'))}
                    )
                  ]
                  spids: [647 661]
                )
              ]
            )
            (C {<touch>} {(DQ ($ Id.VSub_DollarName '$name'))})
            (C {<chmod>} {<0600>} {(DQ ($ Id.VSub_DollarName '$name'))})
          ]
        )
    )
    (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: [
            (C {<echo>} {(DQ <'Nothing to do: no log files big enough or old enough to rotate'>)})
          ]
          spids: [712 726]
        )
      ]
    )
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)