(command.CommandList
  children: [
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:listall)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [20]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:errors)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [24]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:checked)
              op: assign_op.Equal
              rhs: {<0>}
              spids: [28]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} 
                      {(DQ <-a>)} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:listall)
                      op: assign_op.Equal
                      rhs: {<1>}
                      spids: [53]
                    )
                  ]
                )
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
          ]
          spids: [32 50]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_Number '$1'))} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {<echo>}
                    {
                      (DQ <'Usage: '> 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: (C {<basename>} {($ Id.VSub_Number '$0')})
                        ) <' [-a] URL'>
                      )
                    }
                  ]
                  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: [62 76]
        )
      ]
    )
    (C {<trap>} 
      {
        (DQ (command_sub left_token:<Id.Left_Backtick '`'> child:(C {<which>} {<rm>})) 
          <' -f traverse*.errors reject*.dat traverse*.dat'>
        )
      } {<0>}
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:outfile)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<echo>} {(DQ ($ Id.VSub_Number '$1'))})
                        (C {<cut>} {<'-d/'>} {<-f3>})
                      ]
                      negated: F
                    )
                ) <.errors.ext>
              )
            }
          spids: [119]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:URLlist)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<echo>} {($ Id.VSub_Number '$1')})
                        (C {<cut>} {<'-d/'>} {<-f3>})
                        (C {<sed>} {(SQ <'s/www\\.//'>)})
                      ]
                      negated: F
                    )
                ) <.rejects>
              )
            }
          spids: [139]
        )
      ]
    )
    (C {<rm>} {<-f>} {($ Id.VSub_DollarName '$outfile')})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-e>} 
                      {(DQ ($ Id.VSub_DollarName '$URLlist'))} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {<echo>}
                    {
                      (DQ <'File '> ($ Id.VSub_DollarName '$URLlist') 
                        <' not found. Please run checklinks first.'>
                      )
                    }
                  ]
                  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: [176 192]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-s>} 
                      {(DQ ($ Id.VSub_DollarName '$URLlist'))} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ <'There don\'t appear to be any external links ('> 
                    ($ Id.VSub_DollarName '$URLlist') <' is empty)'>
                  )
                }
              ]
              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: [214 230]
        )
      ]
    )
    (command.ForEach
      iter_name: URL
      iter_words: [
        {
          (command_sub
            left_token: <Id.Left_DollarParen '$('>
            child: 
              (command.Pipeline
                children: [(C {<cat>} {($ Id.VSub_DollarName '$URLlist')}) (C {<sort>}) (C {<uniq>})]
                negated: F
              )
          )
        }
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [{<curl>} {<-s>} {(DQ ($ Id.VSub_DollarName '$URL'))}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<'/dev/null'>}
                    )
                    (redir
                      op: <Id.Redir_GreatAnd '2>&'>
                      loc: (redir_loc.Fd fd:2)
                      arg: {<1>}
                    )
                  ]
                  do_fork: T
                )
              terminator: <Id.Op_Semi _>
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:return)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_QMark '$?')}
                  spids: [295]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$return')} {<-eq>} {<0>} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$listall')} 
                                      {<-eq>} {<1>} {<Id.Lit_RBracket ']'>}
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [(C {<echo>} {(DQ ($ Id.VSub_DollarName '$URL') <' is fine.'>)})]
                          spids: [316 330]
                        )
                      ]
                    )
                  ]
                  spids: [299 313]
                )
              ]
              else_action: [
                (C {<echo>} 
                  {
                    (DQ ($ Id.VSub_DollarName '$URL') <' fails with error code '> 
                      ($ Id.VSub_DollarName '$return')
                    )
                  }
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:errors)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (word_part.ArithSub
                            anode: 
                              (arith_expr.Binary
                                op_id: Id.Arith_Plus
                                left: {($ Id.VSub_DollarName '$errors')}
                                right: {<Id.Lit_Digits 1>}
                              )
                          )
                        }
                      spids: [356]
                    )
                  ]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:checked)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (word_part.ArithSub
                        anode: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Plus
                            left: {($ Id.VSub_DollarName '$checked')}
                            right: {<Id.Lit_Digits 1>}
                          )
                      )
                    }
                  spids: [372]
                )
              ]
            )
          ]
        )
    )
    (C {<echo>} {(DQ )})
    (C {<echo>} 
      {
        (DQ <'Done. Checked '> ($ Id.VSub_DollarName '$checked') <' URLs and found '> 
          ($ Id.VSub_DollarName '$errors') <' errors.'>
        )
      }
    )
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)