(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LOCALEDIR)
          op: assign_op.Equal
          rhs: {<'/usr/share/locale'>}
          spids: [22]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_Number '$1'))} 
                      {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ )} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:LOCALEDIR)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [46]
                )
              ]
            )
          ]
          spids: [26 43]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-x>} {<'./localeck'>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'ERROR: build test program first.'>)})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [52 65]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:PATH_LOCALE)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$LOCALEDIR')}
          spids: [82]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LOCALES)
          op: assign_op.Equal
          rhs: {<0>}
          spids: [85]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:ERRORS)
          op: assign_op.Equal
          rhs: {<0>}
          spids: [88]
        )
      ]
    )
    (C {<echo>} {(DQ <'Validating locales in '> ($ Id.VSub_DollarName '$LOCALEDIR'))})
    (C {<echo>})
    (command.ForEach
      iter_names: [i]
      iterable: 
        (for_iter.Words
          words: [
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                child: (C {<ls>} {<-1>} {($ Id.VSub_DollarName '$LOCALEDIR')})
              )
            }
          ]
        )
      body: 
        (command.DoGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:LOCALES)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (word_part.ArithSub
                        anode: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Plus
                            left: {($ Id.VSub_DollarName '$LOCALES')}
                            right: {<Id.Lit_Digits 1>}
                          )
                      )
                    }
                  spids: [121]
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<'./localeck'>} {($ Id.VSub_DollarName '$i')})
                (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: [138]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (C {<echo>})
    (C {<echo>} {(DQ <'Validation test complete'>)})
    (C {<echo>} {(DQ ($ Id.VSub_DollarName '$LOCALES') <' locales were checked'>)})
    (C {<echo>} {(DQ ($ Id.VSub_DollarName '$ERRORS') <' invalid locales were found'>)})
  ]
)