(command.CommandList
  children: [
    (command.ShFunction
      name: err_exit
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (C {<print>} {<-u2>} {<-n>} {(DQ <Id.Lit_BadBackslash '\\'> <t>)})
            (C {<print>} {<-u2>} {<-r>} 
              {(${ Id.VSub_Name Command) <Id.Lit_LBracket '['> ($ Id.VSub_Number 1) 
                <Id.Lit_RBracket ']'> <Id.Lit_Colon ':'>
              } 
              {
                (DQ 
                  (braced_var_sub
                    left: <Id.Left_DollarBrace '${'>
                    token: <Id.VSub_At '@'>
                    var_name: '@'
                    suffix_op: (suffix_op.Slice begin:{<Id.Lit_Digits 2>})
                    right: <Id.Arith_RBrace _>
                  )
                )
              }
            )
            (C {<let>} {<Id.Lit_VarLike 'Errors+='> <1>})
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (C {<alias>} {<Id.Lit_VarLike 'err_exit='> (SQ <'err_exit $LINENO'>)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'Command='> name:Command)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                left: <Id.Left_DollarBrace '${'>
                token: <Id.VSub_Number 0>
                var_name: 0
                suffix_op: 
                  (suffix_op.Unary
                    op: <Id.VOp1_DPound '##'>
                    arg_word: {<Id.Lit_Other '*'> <Id.Lit_Slash '/'>}
                  )
                right: <Id.Right_DollarBrace '}'>
              )
            }
          spids: [114]
        )
      ]
      redirects: []
    )
    (C {<integer>} {<Id.Lit_VarLike 'Errors='> <0>})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'tmp='> name:tmp)
              op: assign_op.Equal
              rhs: 
                {
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: (C {<mktemp>} {<-dt>})
                    right: <Id.Eof_RParen _>
                  )
                }
              spids: [128]
            )
          ]
          redirects: []
        )
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Sentence
              child: (C {<err_exit>} {<mktemp>} {<-dt>} {<failed>})
              terminator: <Id.Op_Semi _>
            )
            (command.Sentence
              child: (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              terminator: <Id.Op_Semi _>
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
      ]
    )
    (C {<trap>} {(DQ <'cd /; rm -rf '> ($ Id.VSub_DollarName tmp))} {<EXIT>})
    (command.ShFunction
      name: abspath
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'base='> name:base)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<basename>} {($ Id.VSub_DollarName SHELL)})
                        right: <Id.Eof_RParen _>
                      )
                    }
                  spids: [172]
                )
              ]
              redirects: []
            )
            (C {<cd>} 
              {
                (braced_var_sub
                  left: <Id.Left_DollarBrace '${'>
                  token: <Id.VSub_Name SHELL>
                  var_name: SHELL
                  suffix_op: 
                    (suffix_op.Unary
                      op: <Id.VOp1_Percent '%'>
                      arg_word: {<Id.Lit_Slash '/'> ($ Id.VSub_DollarName base)}
                    )
                  right: <Id.Right_DollarBrace '}'>
                )
              }
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'newdir='> name:newdir)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<pwd>})
                        right: <Id.Eof_RParen _>
                      )
                    }
                  spids: [190]
                )
              ]
              redirects: []
            )
            (C {<cd>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~-'> user_name:-)})
            (C {<print>} {($ Id.VSub_DollarName newdir) <'/'> ($ Id.VSub_DollarName base)})
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (C {<builtin>} {<getconf>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'ABSHELL='> name:ABSHELL)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: (C {<abspath>})
                right: <Id.Eof_RParen _>
              )
            }
          spids: [216]
        )
      ]
      redirects: []
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<cd>} {($ Id.VSub_DollarName tmp)})
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Sentence
              child: (C {<err_exit>} {(DQ <'cd '> ($ Id.VSub_DollarName tmp) <' failed'>)})
              terminator: <Id.Op_Semi _>
            )
            (command.Sentence
              child: (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              terminator: <Id.Op_Semi _>
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
      ]
    )
    (command.Simple
      words: [{<print>} {<Id.ControlFlow_Exit exit>} {<0>}]
      redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<.profile>})]
      more_env: []
      do_fork: T
    )
    (command.Simple
      words: [{(${ Id.VSub_Name ABSHELL)}]
      redirects: [
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<Id.KW_Bang '!'>}
              here_end_span_id: 364
              stdin_parts: [
                <'HOME='>
                ($ Id.VSub_DollarName PWD)
                <' '>
                <'PATH='>
                ($ Id.VSub_DollarName PATH)
                <' '>
                <'SHELL='>
                ($ Id.VSub_DollarName ABSSHELL)
                <' '>
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.CommandList
                      children: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'v='> name:v)
                              op: assign_op.Equal
                              rhs: 
                                {
                                  (command_sub
                                    left_token: <Id.Left_DollarParen '$('>
                                    child: (C {<getconf>} {<LIBPATH>})
                                    right: <Id.Eof_RParen _>
                                  )
                                }
                              spids: [276]
                            )
                          ]
                          redirects: []
                        )
                        (command.ForEach
                          iter_names: [v]
                          iterable: 
                            (for_iter.Words
                              words: [
                                {
                                  (braced_var_sub
                                    left: <Id.Left_DollarBrace '${'>
                                    token: <Id.VSub_Name v>
                                    var_name: v
                                    suffix_op: 
                                      (suffix_op.PatSub
                                        pat: {<','>}
                                        replace: {<' '>}
                                        replace_mode: Id.Lit_Slash
                                        slash_tok: <Id.VOp2_Slash _>
                                      )
                                    right: <Id.Right_DollarBrace '}'>
                                  )
                                }
                              ]
                            )
                          body: 
                            (command.DoGroup
                              children: [
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'v='> name:v)
                                      op: assign_op.Equal
                                      rhs: 
                                        {
                                          (braced_var_sub
                                            left: <Id.Left_DollarBrace '${'>
                                            token: <Id.VSub_Name v>
                                            var_name: v
                                            suffix_op: 
                                              (suffix_op.Unary
                                                op: <Id.VOp1_Pound '#'>
                                                arg_word: {<Id.Lit_Other '*'> <':'>}
                                              )
                                            right: <Id.Right_DollarBrace '}'>
                                          )
                                        }
                                      spids: [302]
                                    )
                                  ]
                                  redirects: []
                                )
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'v='> name:v)
                                      op: assign_op.Equal
                                      rhs: 
                                        {
                                          (braced_var_sub
                                            left: <Id.Left_DollarBrace '${'>
                                            token: <Id.VSub_Name v>
                                            var_name: v
                                            suffix_op: 
                                              (suffix_op.Unary
                                                op: <Id.VOp1_DPercent '%%'>
                                                arg_word: {<':'> <Id.Lit_Other '*'>}
                                              )
                                            right: <Id.Right_DollarBrace '}'>
                                          )
                                        }
                                      spids: [311]
                                    )
                                  ]
                                  redirects: []
                                )
                                (command.AndOr
                                  ops: [Id.Op_DAmp]
                                  children: [
                                    (C {<eval>} {<Id.KW_DLeftBracket '[['>} 
                                      {
                                        (word_part.EscapedLiteral
                                          token: <Id.Lit_EscapedChar '\\$'>
                                          ch: '$'
                                        ) ($ Id.VSub_DollarName v)
                                      } {<Id.Lit_RBracket ']'> <Id.Lit_RBracket ']'>}
                                    )
                                    (C {<eval>} {<print>} {<-n>} 
                                      {
                                        (word_part.EscapedLiteral
                                          token: <Id.Lit_EscapedChar '\\"'>
                                          ch: '"'
                                        )
                                      } 
                                      {
                                        (word_part.EscapedLiteral
                                          token: <Id.Lit_EscapedChar '\\"'>
                                          ch: '"'
                                        ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'> ch:'$') <Id.Lit_VarLike 'v='> 
                                        (word_part.EscapedLiteral
                                          token: <Id.Lit_EscapedChar '\\"'>
                                          ch: '"'
                                        ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'> ch:'$') ($ Id.VSub_DollarName v) 
                                        (word_part.EscapedLiteral
                                          token: <Id.Lit_EscapedChar '\\"'>
                                          ch: '"'
                                        )
                                      }
                                    )
                                  ]
                                )
                              ]
                            )
                          redirects: []
                        )
                      ]
                    )
                  right: <Id.Eof_RParen _>
                )
                <' '>
                <'exec -c -a -ksh '>
                (${ Id.VSub_Name ABSHELL)
                <' -c '>
                <Id.Right_DoubleQuote '"'>
                <'exit 1'>
                <Id.Right_DoubleQuote '"'>
                <' 1>/dev/null 2>&1\n'>
              ]
            )
        )
      ]
      more_env: []
      do_fork: T
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'status='> name:status)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: (C {<echo>} {($ Id.VSub_QMark '?')})
                right: <Id.Eof_RParen _>
              )
            }
          spids: [365]
        )
      ]
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalAnd
                      left: (bool_expr.Unary op_id:Id.BoolUnary_o child:{<noprivileged>})
                      right: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobNEqual
                          left: {($ Id.VSub_DollarName status)}
                          right: {<0>}
                        )
                    )
                  redirects: []
                )
              ]
            )
          action: [(C {<err_exit>} {(SQ <'exit in .profile is ignored'>)})]
          spids: [372 390]
        )
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.LogicalAnd
                      left: (bool_expr.Unary op_id:Id.BoolUnary_o child:{<privileged>})
                      right: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_GlobDEqual
                          left: {($ Id.VSub_DollarName status)}
                          right: {<0>}
                        )
                    )
                  redirects: []
                )
              ]
            )
          action: [(C {<err_exit>} {(SQ <'privileged .profile not ignored'>)})]
          spids: [398 416]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: 
                        {
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: 
                              (command.CommandList
                                children: [
                                  (command.Sentence
                                    child: 
                                      (C {<trap>} {(SQ <'code=$?; echo $code; trap 0; exit $code'>)} 
                                        {<0>}
                                      )
                                    terminator: <Id.Op_Semi _>
                                  )
                                  (command.ControlFlow
                                    token: <Id.ControlFlow_Exit exit>
                                    arg_word: {<123>}
                                  )
                                ]
                              )
                            right: <Id.Eof_RParen _>
                          )
                        }
                      right: {<123>}
                    )
                  redirects: []
                )
              ]
            )
          action: [(C {<err_exit>} {(SQ <'exit not setting $?'>)})]
          spids: [426 451]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<run.sh>})
        (redir
          op: <Id.Redir_DLessDash '<<-'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(DQ <EOF>)}
              here_end_span_id: 475
              stdin_parts: [
                <'trap \'code=$?; echo $code; trap 0; exit $code\' 0\n'>
                <'( trap 0; exit 123 )\n'>
              ]
            )
        )
      ]
      more_env: []
      do_fork: T
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: 
                        {
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: (C {($ Id.VSub_DollarName SHELL)} {<'./run.sh'>})
                            right: <Id.Eof_RParen _>
                          )
                        }
                      right: {<123>}
                    )
                  redirects: []
                )
              ]
            )
          action: [(C {<err_exit>} {(SQ <'subshell trap on exit overwrites parent trap'>)})]
          spids: [476 492]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<cd>} {(word_part.TildeSub token:<Id.Lit_TildeLike '~-'> user_name:-)})
        (C {<err_exit>} {(DQ <'cd back failed'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Simple
          words: [
            {($ Id.VSub_DollarName SHELL)}
            {<-c>}
            {(SQ <'builtin -f cmd getconf; getconf --"?-version"; exit 0'>)}
          ]
          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>})
          ]
          more_env: []
          do_fork: T
        )
        (C {<err_exit>} 
          {(SQ <'ksh plugin exit failed -- was ksh built with CCFLAGS+=$(CC.EXPORT.DYNAMIC)?'>)}
        )
      ]
    )
    (command.ControlFlow
      token: <Id.ControlFlow_Exit exit>
      arg_word: {(word_part.ArithSub anode:($ Id.Lit_ArithVarLike Errors))}
    )
  ]
)