(CommandList
  children: [
    (FuncDef
      name: err_exit
      body: 
        (BraceGroup
          children: [
            (C {(print)} {(-u2)} {(-n)} {(DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">))})
            (C {(print)} {(-u2)} {(-r)} 
              {(${ VSub_Name Command) (Lit_Other "[") ($ VSub_Number "$1") (Lit_Other "]") 
                (Lit_Other ":")
              } 
              {
                (DQ 
                  (BracedVarSub
                    token: <VSub_At "@">
                    suffix_op: (Slice begin:(ArithWord w:{(Lit_Digits 2)}))
                    spids: [90 94]
                  )
                )
              }
            )
            (C {(let)} {(Lit_VarLike "Errors+=") (1)})
          ]
          spids: [61]
        )
      spids: [57 60]
    )
    (C {(alias)} {(Lit_VarLike "err_exit=") (SQ <"err_exit $LINENO">)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:Command)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Number 0>
                suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*") (Lit_Slash /)})
                spids: [114 119]
              )
            }
          spids: [113]
        )
      ]
      spids: [113]
    )
    (C {(integer)} {(Lit_VarLike "Errors=") (0)})
    (AndOr
      children: [
        (Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (LhsName name:tmp)
              op: Equal
              rhs: 
                {
                  (CommandSubPart
                    command_list: (CommandList children:[(C {(mktemp)} {(-dt)})])
                    left_token: <Left_CommandSub "$(">
                    spids: [128 132]
                  )
                }
              spids: [127]
            )
          ]
          spids: [127]
        )
        (BraceGroup
          children: [
            (Sentence
              child: (C {(err_exit)} {(mktemp)} {(-dt)} {(failed)})
              terminator: <Op_Semi ";">
            )
            (Sentence child:(C {(exit)} {(1)}) terminator:<Op_Semi ";">)
          ]
          spids: [136]
        )
      ]
      op_id: Op_DPipe
    )
    (C {(trap)} {(DQ ("cd /; rm -rf ") ($ VSub_Name "$tmp"))} {(EXIT)})
    (FuncDef
      name: abspath
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:base)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(basename)} {($ VSub_Name "$SHELL")})]
                          )
                        left_token: <Left_CommandSub "$(">
                        spids: [172 176]
                      )
                    }
                  spids: [171]
                )
              ]
              spids: [171]
            )
            (C {(cd)} 
              {
                (BracedVarSub
                  token: <VSub_Name SHELL>
                  suffix_op: 
                    (StringUnary
                      op_id: VOp1_Percent
                      arg_word: {(Lit_Slash /) ($ VSub_Name "$base")}
                    )
                  spids: [181 186]
                )
              }
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:newdir)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(pwd)})])
                        left_token: <Left_CommandSub "$(">
                        spids: [190 192]
                      )
                    }
                  spids: [189]
                )
              ]
              spids: [189]
            )
            (C {(cd)} {(TildeSubPart prefix:-)})
            (C {(print)} {($ VSub_Name "$newdir") (/) ($ VSub_Name "$base")})
          ]
          spids: [168]
        )
      spids: [164 167]
    )
    (C {(builtin)} {(getconf)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:ABSHELL)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: (CommandList children:[(C {(abspath)})])
                left_token: <Left_CommandSub "$(">
                spids: [217 219]
              )
            }
          spids: [216]
        )
      ]
      spids: [216]
    )
    (AndOr
      children: [
        (C {(cd)} {($ VSub_Name "$tmp")})
        (BraceGroup
          children: [
            (Sentence
              child: (C {(err_exit)} {(DQ ("cd ") ($ VSub_Name "$tmp") (" failed"))})
              terminator: <Op_Semi ";">
            )
            (Sentence child:(C {(exit)} {(1)}) terminator:<Op_Semi ";">)
          ]
          spids: [227]
        )
      ]
      op_id: Op_DPipe
    )
    (SimpleCommand
      words: [{(print)} {(exit)} {(0)}]
      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.profile)} spids:[251])]
    )
    (SimpleCommand
      words: [{(${ VSub_Name ABSHELL)}]
      redirects: [
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("HOME=") ($ VSub_Name "$PWD") (" ") ("PATH=") ($ VSub_Name "$PATH") (" ") ("SHELL=") 
                ($ VSub_Name "$ABSSHELL") (" ") 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:v)
                              op: Equal
                              rhs: 
                                {
                                  (CommandSubPart
                                    command_list: 
                                      (CommandList
                                        children: [(C {(getconf)} {(LIBPATH)})]
                                      )
                                    left_token: <Left_CommandSub "$(">
                                    spids: [277 281]
                                  )
                                }
                              spids: [276]
                            )
                          ]
                          spids: [276]
                        )
                        (ForEach
                          iter_name: v
                          iter_words: [
                            {
                              (BracedVarSub
                                token: <VSub_Name v>
                                suffix_op: 
                                  (PatSub
                                    pat: {(",")}
                                    replace: {(" ")}
                                    do_all: True
                                    do_prefix: False
                                    do_suffix: False
                                  )
                                spids: [290 297]
                              )
                            }
                          ]
                          do_arg_iter: False
                          body: 
                            (DoGroup
                              children: [
                                (Assignment
                                  keyword: Assign_None
                                  pairs: [
                                    (assign_pair
                                      lhs: (LhsName name:v)
                                      op: Equal
                                      rhs: 
                                        {
                                          (BracedVarSub
                                            token: <VSub_Name v>
                                            suffix_op: (StringUnary op_id:VOp1_Pound arg_word:{("*:")})
                                            spids: [303 307]
                                          )
                                        }
                                      spids: [302]
                                    )
                                  ]
                                  spids: [302]
                                )
                                (Assignment
                                  keyword: Assign_None
                                  pairs: [
                                    (assign_pair
                                      lhs: (LhsName name:v)
                                      op: Equal
                                      rhs: 
                                        {
                                          (BracedVarSub
                                            token: <VSub_Name v>
                                            suffix_op: 
                                              (StringUnary
                                                op_id: VOp1_DPercent
                                                arg_word: {(":*")}
                                              )
                                            spids: [311 315]
                                          )
                                        }
                                      spids: [310]
                                    )
                                  ]
                                  spids: [310]
                                )
                                (AndOr
                                  children: [
                                    (C {(eval)} {(KW_DLeftBracket "[[")} 
                                      {(EscapedLiteralPart token:<Lit_EscapedChar "\\$">) 
                                        ($ VSub_Name "$v")
                                      } {(Lit_Other "]") (Lit_Other "]")}
                                    )
                                    (C {(eval)} {(print)} {(-n)} 
                                      {(EscapedLiteralPart token:<Lit_EscapedChar "\\\"">)} 
                                      {(EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) 
                                        (EscapedLiteralPart
                                          token: <Lit_EscapedChar "\\$">
                                        ) (Lit_VarLike "v=") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) 
                                        (EscapedLiteralPart
                                          token: <Lit_EscapedChar "\\$">
                                        ) ($ VSub_Name "$v") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">)
                                      }
                                    )
                                  ]
                                  op_id: Op_DAmp
                                )
                              ]
                              spids: [300 347]
                            )
                          spids: [289 -1]
                        )
                      ]
                    )
                  left_token: <Left_CommandSub "$(">
                  spids: [273 349]
                ) (" ") ("exec -c -a -ksh ") (${ VSub_Name ABSHELL) (" -c ") (Right_DoubleQuote "\"") ("exit 1") 
                (Right_DoubleQuote "\"") (" 1>/dev/null 2>&1\n")
              )
            }
          do_expansion: True
          here_end: "!"
          was_filled: True
          spids: [258]
        )
      ]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:status)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: (CommandList children:[(C {(echo)} {($ VSub_QMark "$?")})])
                left_token: <Left_CommandSub "$(">
                spids: [362 366]
              )
            }
          spids: [361]
        )
      ]
      spids: [361]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (DBracket
              expr: 
                (LogicalAnd
                  left: (BoolUnary op_id:BoolUnary_o child:{(noprivileged)})
                  right: 
                    (BoolBinary
                      op_id: BoolBinary_GlobNEqual
                      left: {($ VSub_Name "$status")}
                      right: {(0)}
                    )
                )
            )
          ]
          action: [(C {(err_exit)} {(SQ <"exit in .profile is ignored">)})]
          spids: [-1 386]
        )
        (if_arm
          cond: [
            (DBracket
              expr: 
                (LogicalAnd
                  left: (BoolUnary op_id:BoolUnary_o child:{(privileged)})
                  right: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {($ VSub_Name "$status")}
                      right: {(0)}
                    )
                )
            )
          ]
          action: [(C {(err_exit)} {(SQ <"privileged .profile not ignored">)})]
          spids: [394 412]
        )
      ]
      spids: [-1 420]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (DBracket
              expr: 
                (BoolBinary
                  op_id: BoolBinary_GlobNEqual
                  left: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Sentence
                                child: 
                                  (C {(trap)} {(SQ <"code=$?; echo $code; trap 0; exit $code">)} {(0)})
                                terminator: <Op_Semi ";">
                              )
                              (C {(exit)} {(123)})
                            ]
                          )
                        left_token: <Left_CommandSub "$(">
                        spids: [426 439]
                      )
                    }
                  right: {(123)}
                )
            )
          ]
          action: [(C {(err_exit)} {(SQ <"exit not setting $?">)})]
          spids: [-1 447]
        )
      ]
      spids: [-1 455]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{(run.sh)} spids:[459])
        (HereDoc
          op_id: Redir_DLessDash
          fd: -1
          body: {("trap 'code=$?; echo $code; trap 0; exit $code' 0\n") ("( trap 0; exit 123 )\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [463]
        )
      ]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (DBracket
              expr: 
                (BoolBinary
                  op_id: BoolBinary_GlobNEqual
                  left: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {($ VSub_Name "$SHELL")} {(./run.sh)})]
                          )
                        left_token: <Left_CommandSub "$(">
                        spids: [473 477]
                      )
                    }
                  right: {(123)}
                )
            )
          ]
          action: [(C {(err_exit)} {(SQ <"subshell trap on exit overwrites parent trap">)})]
          spids: [-1 485]
        )
      ]
      spids: [-1 493]
    )
    (AndOr
      children: [(C {(cd)} {(TildeSubPart prefix:-)}) (C {(err_exit)} {(DQ ("cd back failed"))})]
      op_id: Op_DPipe
    )
    (AndOr
      children: [
        (SimpleCommand
          words: [
            {($ VSub_Name "$SHELL")}
            {(-c)}
            {(SQ <"builtin -f cmd getconf; getconf --\"?-version\"; exit 0">)}
          ]
          redirects: [
            (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[516])
            (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[519])
          ]
        )
        (C {(err_exit)} 
          {(SQ <"ksh plugin exit failed -- was ksh built with CCFLAGS+=$(CC.EXPORT.DYNAMIC)?">)}
        )
      ]
      op_id: Op_DPipe
    )
    (C {(exit)} 
      {
        (ArithSubPart
          anode: 
            (TernaryOp
              cond: 
                (ArithBinary
                  op_id: Arith_Less
                  left: (ArithVarRef name:Errors)
                  right: (ArithWord w:{(Lit_Digits 125)})
                )
              true_expr: (ArithVarRef name:Errors)
              false_expr: (ArithWord w:{(Lit_Digits 125)})
            )
          spids: [533 542]
        )
      }
    )
  ]
)