(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:logdir) op:Equal rhs:{(DQ (/var/log))} spids:[31])]
      spids: [31]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:config)
          op: Equal
          rhs: {(DQ ($ VSub_Name '$logdir') (/rotatelogs.conf))}
          spids: [39]
        )
      ]
      spids: [39]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:mv) op:Equal rhs:{(DQ (/bin/mv))} spids:[45])]
      spids: [45]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:default_duration) op:Equal rhs:{(7)} spids:[50])]
      spids: [50]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:count) op:Equal rhs:{(0)} spids:[56])]
      spids: [56]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:duration)
          op: Equal
          rhs: {($ VSub_Name '$default_duration')}
          spids: [60]
        )
      ]
      spids: [60]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(KW_Bang '!')} {(-f)} {($ VSub_Name '$config')} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (Sentence
              child: 
                (SimpleCommand
                  words: [
                    {(echo)}
                    {(DQ ($ VSub_Number '$0') (": no config file found. Can't proceed."))}
                  ]
                  redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                )
              terminator: <Op_Semi ';'>
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [16777215 78]
        )
      ]
      spids: [16777215 108]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(KW_Bang '!')} {(-w)} {($ VSub_Name '$logdir')} {(-o)} 
                  {(KW_Bang '!')} {(-x)} {($ VSub_Name '$logdir')} {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (SimpleCommand
              words: [
                {(echo)}
                {
                  (DQ ($ VSub_Number '$0') (": you don't have the appropriate permissions in ") 
                    ($ VSub_Name '$logdir')
                  )
                }
              ]
              redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [16777215 133]
        )
      ]
      spids: [16777215 160]
    )
    (C {(cd)} {($ VSub_Name '$logdir')})
    (ForEach
      iter_name: name
      iter_words: [
        {
          (CommandSubPart
            command_list: 
              (CommandList
                children: [
                  (Pipeline
                    children: [
                      (C {(find)} {(.)} {(-maxdepth)} {(1)} {(-type)} {(f)} {(-size)} {(Lit_Other '+') (0c)} 
                        {(KW_Bang '!')} {(-name)} {(SQ <'*[0-9]*'>)} {(KW_Bang '!')} {(-name)} {(SQ <'\\.*'>)} {(KW_Bang '!')} {(-name)} 
                        {(SQ <'*conf'>)} {(-print)}
                      )
                      (C {(sed)} {(SQ <'s/^\\.\\///'>)})
                    ]
                    negated: F
                  )
                ]
              )
            left_token: <Left_CommandSub '$('>
            spids: [191 244]
          )
        }
      ]
      do_arg_iter: F
      body: 
        (DoGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:count)
                  op: Equal
                  rhs: 
                    {
                      (ArithSubPart
                        anode: 
                          (ArithBinary
                            op_id: Arith_Plus
                            left: (ArithWord w:{($ VSub_Name '$count')})
                            right: (ArithWord w:{(Lit_Digits 1)})
                          )
                        spids: [251 260]
                      )
                    }
                  spids: [250]
                )
              ]
              spids: [250]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:duration)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (Pipeline
                                  children: [
                                    (C {(grep)} {(DQ ('^') (${ VSub_Name name) ('='))} 
                                      {($ VSub_Name '$config')}
                                    )
                                    (C {(cut)} {(-d) (Lit_Other '=')} {(-f2)})
                                  ]
                                  negated: F
                                )
                              ]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [271 290]
                        )
                      )
                    }
                  spids: [269]
                )
              ]
              spids: [269]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$duration'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:duration)
                          op: Equal
                          rhs: {($ VSub_Name '$default_duration')}
                          spids: [314]
                        )
                      ]
                      spids: [314]
                    )
                  ]
                  spids: [16777215 310]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$duration'))} {(Lit_Other '=')} {(DQ (0))} 
                          {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} {(DQ ('Duration set to zero: skipping ') ($ VSub_Name '$name'))})
                    (ControlFlow token:<ControlFlow_Continue continue>)
                  ]
                  spids: [321 339]
                )
              ]
              spids: [16777215 353]
            )
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:back1)
                      op: Equal
                      rhs: {(DQ (${ VSub_Name name) (.1))}
                      spids: [362]
                    )
                  ]
                  spids: [362]
                )
              terminator: <Op_Semi ';'>
            )
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:back2)
                      op: Equal
                      rhs: {(DQ (${ VSub_Name name) (.2))}
                      spids: [371]
                    )
                  ]
                  spids: [371]
                )
              terminator: <Op_Semi ';'>
            )
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:back3)
                      op: Equal
                      rhs: {(DQ (${ VSub_Name name) (.3))}
                      spids: [381]
                    )
                  ]
                  spids: [381]
                )
              terminator: <Op_Semi ';'>
            )
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:back4)
                      op: Equal
                      rhs: {(DQ (${ VSub_Name name) (.4))}
                      spids: [390]
                    )
                  ]
                  spids: [390]
                )
              terminator: <Op_Semi ';'>
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$back1'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (C {(Lit_Other '[')} {(-z)} 
                              {
                                (DQ 
                                  (CommandSubPart
                                    command_list: 
                                      (CommandList
                                        children: [
                                          (SimpleCommand
                                            words: [
                                              {(find)}
                                              {(EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) 
                                                ($ VSub_Name '$back1') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>)
                                              }
                                              {(-mtime)}
                                              {(Lit_Other '+') ($ VSub_Name '$duration')}
                                              {(-print)}
                                            ]
                                            redirects: [
                                              (Redir
                                                op: <Redir_Great '2>'>
                                                fd: 2
                                                arg_word: {(/dev/null)}
                                              )
                                            ]
                                          )
                                        ]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [438 454]
                                  )
                                )
                              } {(Lit_Other ']')}
                            )
                          ]
                          action: [
                            (C {(echo)} {(-n)} 
                              {
                                (DQ ($ VSub_Name '$name') 
                                  ("'s most recent backup is more recent than ") ($ VSub_Name '$duration') (' ')
                                )
                              }
                            )
                            (Sentence
                              child: (C {(echo)} {(DQ ('days: skipping'))})
                              terminator: <Op_Semi ';'>
                            )
                            (ControlFlow
                              token: <ControlFlow_Continue continue>
                            )
                          ]
                          spids: [16777215 461]
                        )
                      ]
                      spids: [16777215 487]
                    )
                  ]
                  spids: [16777215 428]
                )
              ]
              spids: [16777215 490]
            )
            (C {(echo)} 
              {
                (DQ ('Rotating log ') ($ VSub_Name '$name') (' (using a ') ($ VSub_Name '$duration') 
                  (' day schedule)')
                )
              }
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$back3'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Sentence
                      child: 
                        (C {(echo)} 
                          {(DQ ('... ') ($ VSub_Name '$back3') (' -> ') ($ VSub_Name '$back4'))}
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (C {($ VSub_Name '$mv')} {(-f)} {(DQ ($ VSub_Name '$back3'))} 
                      {(DQ ($ VSub_Name '$back4'))}
                    )
                  ]
                  spids: [16777215 529]
                )
              ]
              spids: [16777215 556]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$back2'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Sentence
                      child: 
                        (C {(echo)} 
                          {(DQ ('... ') ($ VSub_Name '$back2') (' -> ') ($ VSub_Name '$back3'))}
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (C {($ VSub_Name '$mv')} {(-f)} {(DQ ($ VSub_Name '$back2'))} 
                      {(DQ ($ VSub_Name '$back3'))}
                    )
                  ]
                  spids: [16777215 573]
                )
              ]
              spids: [16777215 600]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$back1'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Sentence
                      child: 
                        (C {(echo)} 
                          {(DQ ('... ') ($ VSub_Name '$back1') (' -> ') ($ VSub_Name '$back2'))}
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (C {($ VSub_Name '$mv')} {(-f)} {(DQ ($ VSub_Name '$back1'))} 
                      {(DQ ($ VSub_Name '$back2'))}
                    )
                  ]
                  spids: [16777215 617]
                )
              ]
              spids: [16777215 644]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$name'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Sentence
                      child: 
                        (C {(echo)} 
                          {(DQ ('... ') ($ VSub_Name '$name') (' -> ') ($ VSub_Name '$back1'))}
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (C {($ VSub_Name '$mv')} {(-f)} {(DQ ($ VSub_Name '$name'))} 
                      {(DQ ($ VSub_Name '$back1'))}
                    )
                  ]
                  spids: [16777215 661]
                )
              ]
              spids: [16777215 688]
            )
            (C {(touch)} {(DQ ($ VSub_Name '$name'))})
            (C {(chmod)} {(0600)} {(DQ ($ VSub_Name '$name'))})
          ]
          spids: [246 709]
        )
      spids: [190 16777215]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {($ VSub_Name '$count')} {(-eq)} {(0)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('Nothing to do: no log files big enough or old enough to rotate'))})
          ]
          spids: [16777215 726]
        )
      ]
      spids: [16777215 735]
    )
    (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})
  ]
)