(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: 
        (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: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-z>} 
                              {($ Id.VSub_DollarName '$varvalue')} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} 
                                      {
                                        (DQ 
                                          (braced_var_sub
                                            token: <Id.VSub_Name varvalue>
                                            suffix_op: 
                                              (suffix_op.Unary
                                                tok: <Id.VOp1_Percent '%'>
                                                arg_word: 
                                                  {
                                                    (braced_var_sub
                                                      token: <Id.VSub_Name varvalue>
                                                      suffix_op: 
                                                        (suffix_op.Unary
                                                          tok: <Id.VOp1_Pound '#'>
                                                          arg_word: {<Id.Lit_Other '?'>}
                                                        )
                                                    )
                                                  }
                                              )
                                          )
                                        )
                                      } {<Id.Lit_Equals '='>} {(DQ <'/'>)} {<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.KW_Bang '!'>} {<-x>} 
                                              {($ Id.VSub_DollarName '$varvalue')} {<Id.Lit_RBracket ']'>}
                                            )
                                          terminator: <Id.Op_Semi _>
                                        )
                                      ]
                                    )
                                  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: <Id.Lit_ArithVarLike errors>
                                        )
                                    )
                                  ]
                                  spids: [89 103]
                                )
                              ]
                            )
                          ]
                          spids: [60 86]
                        )
                      ]
                      else_action: [
                        (command.If
                          arms: [
                            (if_arm
                              cond: 
                                (condition.Shell
                                  commands: [
                                    (command.Sentence
                                      child: 
                                        (C {<in_path>} {($ Id.VSub_DollarName '$varvalue')} 
                                          {($ Id.VSub_DollarName '$PATH')}
                                        )
                                      terminator: <Id.Op_Semi _>
                                    )
                                  ]
                                )
                              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: {($ Id.VSub_DollarName '$errors')}
                                                right: {<Id.Lit_Digits 1>}
                                              )
                                          )
                                        }
                                      spids: [157]
                                    )
                                  ]
                                )
                              ]
                              spids: [132 142]
                            )
                          ]
                        )
                      ]
                    )
                  ]
                  spids: [43 57]
                )
              ]
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-x>} 
                      {
                        (braced_var_sub
                          token: <Id.VSub_Name SHELL>
                          suffix_op: 
                            (suffix_op.Unary
                              tok: <Id.VTest_ColonQMark ':?'>
                              arg_word: {(DQ <'Cannot proceed without SHELL being defined.'>)}
                            )
                        )
                      } {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          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: {($ Id.VSub_DollarName '$errors')}
                            right: {<Id.Lit_Digits 1>}
                          )
                      )
                    }
                  spids: [221]
                )
              ]
            )
          ]
          spids: [189 209]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-d>} 
                  {
                    (braced_var_sub
                      token: <Id.VSub_Name HOME>
                      suffix_op: 
                        (suffix_op.Unary
                          tok: <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: {($ Id.VSub_DollarName '$errors')}
                            right: {<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: <Id.Op_Semi _>
        )
        (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: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-d>} 
                              {($ Id.VSub_DollarName '$directory')} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  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: {($ Id.VSub_DollarName '$errors')}
                                    right: {<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: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$errors')} {<-gt>} {<0>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          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:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)