(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:errors)
          op: assign_op.Equal
          rhs: {(0)}
          spids: [13]
        )
      ]
    )
    (C {(source)} {(../1/library.sh)})
    (command.ShFunction
      name: validate
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:varname)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [32]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:varvalue)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [37]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-z)} 
                          {($ Id.VSub_DollarName '$varvalue')} {(Id.Lit_RBracket ']')}
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:55)
                    )
                  ]
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Id.Lit_LBracket '[')} 
                                  {
                                    (DQ 
                                      (braced_var_sub
                                        token: (Token id:Id.VSub_Name val:varvalue span_id:66)
                                        suffix_op: 
                                          (suffix_op.Unary
                                            op_id: Id.VOp1_Percent
                                            arg_word: 
                                              {
                                                (braced_var_sub
                                                  token: 
                                                    (Token
                                                      id: Id.VSub_Name
                                                      val: varvalue
                                                      span_id: 69
                                                    )
                                                  suffix_op: 
                                                    (suffix_op.Unary
                                                      op_id: Id.VOp1_Pound
                                                      arg_word: {('?')}
                                                    )
                                                )
                                              }
                                          )
                                      )
                                    )
                                  } {(Id.Lit_Equals '=')} {(DQ (/))} {(Id.Lit_RBracket ']')}
                                )
                              terminator: (Token id:Id.Op_Semi val:';' span_id:84)
                            )
                          ]
                          action: [
                            (command.If
                              arms: [
                                (if_arm
                                  cond: [
                                    (command.Sentence
                                      child: 
                                        (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-x)} 
                                          {($ Id.VSub_DollarName '$varvalue')} {(Id.Lit_RBracket ']')}
                                        )
                                      terminator: (Token id:Id.Op_Semi val:';' span_id:101)
                                    )
                                  ]
                                  action: [
                                    (C {(echo)} 
                                      {
                                        (DQ ('** ') ($ Id.VSub_DollarName '$varname') (' set to ') 
                                          ($ Id.VSub_DollarName '$varvalue') (', but I cannot find executable.')
                                        )
                                      }
                                    )
                                    (command.DParen
                                      child: 
                                        (arith_expr.UnaryAssign
                                          op_id: Id.Node_PostDPlus
                                          child: (sh_lhs_expr.Name name:errors)
                                        )
                                    )
                                  ]
                                  spids: [89 103]
                                )
                              ]
                            )
                          ]
                          spids: [60 86]
                        )
                      ]
                      else_action: [
                        (command.If
                          arms: [
                            (if_arm
                              cond: [
                                (command.Sentence
                                  child: 
                                    (C {(in_path)} {($ Id.VSub_DollarName '$varvalue')} 
                                      {($ Id.VSub_DollarName '$PATH')}
                                    )
                                  terminator: (Token id:Id.Op_Semi val:';' span_id:140)
                                )
                              ]
                              action: [
                                (C {(echo)} 
                                  {
                                    (DQ ('** ') ($ Id.VSub_DollarName '$varname') (' set to ') 
                                      ($ Id.VSub_DollarName '$varvalue') (', but I cannot find it in PATH.')
                                    )
                                  }
                                )
                                (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: 
                                                  (arith_expr.ArithWord
                                                    w: {($ Id.VSub_DollarName '$errors')}
                                                  )
                                                right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                                              )
                                          )
                                        }
                                      spids: [157]
                                    )
                                  ]
                                )
                              ]
                              spids: [132 142]
                            )
                          ]
                        )
                      ]
                    )
                  ]
                  spids: [43 57]
                )
              ]
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-x)} 
                  {
                    (braced_var_sub
                      token: (Token id:Id.VSub_Name val:SHELL span_id:198)
                      suffix_op: 
                        (suffix_op.Unary
                          op_id: Id.VTest_ColonQMark
                          arg_word: {(DQ ('Cannot proceed without SHELL being defined.'))}
                        )
                    )
                  } {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:207)
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ ('** SHELL set to ') ($ Id.VSub_DollarName '$SHELL') 
                  (', but I cannot find that executable.')
                )
              }
            )
            (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: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$errors')})
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [221]
                )
              ]
            )
          ]
          spids: [189 209]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-d)} 
              {
                (braced_var_sub
                  token: (Token id:Id.VSub_Name val:HOME span_id:245)
                  suffix_op: 
                    (suffix_op.Unary
                      op_id: Id.VTest_ColonQMark
                      arg_word: {(DQ ('You need to have your HOME set to your home directory'))}
                    )
                )
              } {(Id.Lit_RBracket ']')}
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ ('** HOME set to ') ($ Id.VSub_DollarName '$HOME') (", but it's not a directory."))
              }
            )
            (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: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$errors')})
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [266]
                )
              ]
            )
          ]
          spids: [236 254]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:oldIFS)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_DollarName '$IFS')}
                  spids: [285]
                )
              ]
            )
          terminator: (Token id:Id.Op_Semi val:';' span_id:287)
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:IFS)
              op: assign_op.Equal
              rhs: {(DQ (':'))}
              spids: [289]
            )
          ]
        )
      ]
    )
    (command.ForEach
      iter_name: directory
      iter_words: [{($ Id.VSub_DollarName '$PATH')}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-d)} 
                          {($ Id.VSub_DollarName '$directory')} {(Id.Lit_RBracket ']')}
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:321)
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ('** PATH contains invalid directory ') 
                          ($ Id.VSub_DollarName '$directory')
                        )
                      }
                    )
                    (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: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$errors')})
                                    right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                                  )
                              )
                            }
                          spids: [334]
                        )
                      ]
                    )
                  ]
                  spids: [309 323]
                )
              ]
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:IFS)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$oldIFS')}
          spids: [352]
        )
      ]
    )
    (C {(validate)} {(DQ (EDITOR))} {($ Id.VSub_DollarName '$EDITOR')})
    (C {(validate)} {(DQ (MAILER))} {($ Id.VSub_DollarName '$MAILER')})
    (C {(validate)} {(DQ (PAGER))} {($ Id.VSub_DollarName '$PAGER')})
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$errors')} {(-gt)} {(0)} 
                  {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:410)
            )
          ]
          action: [(C {(echo)} {(DQ ('Errors encountered. Please notify sysadmin for help.'))})]
          spids: [398 412]
        )
      ]
      else_action: [(C {(echo)} {(DQ ('Your environment checks out fine.'))})]
    )
    (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:433) arg_word:{(0)})
  ]
)