(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_DollarName Command) <Id.Lit_Colon ':'>} 
              {(DQ ($ Id.VSub_At '@'))}
            )
            (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: [105]
        )
      ]
      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: [119]
            )
          ]
          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: home
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (C {<typeset>} {<Id.Lit_VarLike 'IFS='> <Id.Lit_Colon ':'>} 
              {<Id.Lit_VarLike 'pwd='> <'/etc/passwd'>}
            )
            (C {<set>} {<-o>} {<noglob>})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (command.DBracket
                              expr: 
                                (bool_expr.Unary
                                  op_id: Id.BoolUnary_f
                                  child: {($ Id.VSub_DollarName pwd)}
                                )
                              redirects: []
                            )
                            (command.Simple
                              words: [
                                {<grep>}
                                {<-c>}
                                {(DQ <'^'> ($ Id.VSub_Number 1) <':'>)}
                                {($ Id.VSub_DollarName pwd)}
                              ]
                              redirects: [
                                (redir
                                  op: <Id.Redir_Great '>'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {<'/dev/null'>}
                                )
                              ]
                              more_env: []
                              do_fork: T
                            )
                          ]
                        )
                      ]
                    )
                  action: [
                    (C {<set>} {<-->} 
                      {
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: 
                            (C {<grep>} {(DQ <'^'> ($ Id.VSub_Number 1) <':'>)} 
                              {($ Id.VSub_DollarName pwd)}
                            )
                          right: <Id.Eof_RParen _>
                        )
                      }
                    )
                    (C {<print>} {<-r>} {<-->} {(DQ ($ Id.VSub_Number 6))})
                  ]
                  spids: [182 211]
                )
              ]
              else_action: [(C {<print>} {<.>})]
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'OLDPWD='> name:OLDPWD)
          op: assign_op.Equal
          rhs: {<'/bin'>}
          spids: [253]
        )
      ]
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>)}
                      right: {($ Id.VSub_DollarName HOME)}
                    )
                  redirects: []
                )
              ]
            )
          action: [(C {<err_exit>} {(SQ <'~'>)} {<not>} {($ Id.VSub_DollarName HOME)})]
          spids: [256 268]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'x='> name:x)
          op: assign_op.Equal
          rhs: {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>)}
          spids: [282]
        )
      ]
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {($ Id.VSub_DollarName x)}
                      right: {($ Id.VSub_DollarName HOME)}
                    )
                  redirects: []
                )
              ]
            )
          action: [
            (C {<err_exit>} {<Id.Lit_VarLike 'x='> <Id.Lit_TildeLike '~'>} {<not>} 
              {($ Id.VSub_DollarName HOME)}
            )
          ]
          spids: [285 297]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'x='> name:x)
          op: assign_op.Equal
          rhs: {<x> <Id.Lit_Colon ':'> (word_part.TildeSub token:<Id.Lit_TildeLike '~'>)}
          spids: [310]
        )
      ]
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {($ Id.VSub_DollarName x)}
                      right: {<x> <Id.Lit_Colon ':'> ($ Id.VSub_DollarName HOME)}
                    )
                  redirects: []
                )
              ]
            )
          action: [
            (C {<err_exit>} {<Id.Lit_VarLike 'x='> <x> <Id.Lit_Colon ':'> <Id.Lit_TildeLike '~'>} 
              {<not>} {<x> <Id.Lit_Colon ':'> ($ Id.VSub_DollarName HOME)}
            )
          ]
          spids: [315 329]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {<Id.Lit_TildeLike '~'> <Id.Lit_Other '+'>}
                      right: {($ Id.VSub_DollarName PWD)}
                    )
                  redirects: []
                )
              ]
            )
          action: [(C {<err_exit>} {(SQ <'~'>)} {<not>} {($ Id.VSub_DollarName PWD)})]
          spids: [346 359]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'x='> name:x)
          op: assign_op.Equal
          rhs: {<Id.Lit_TildeLike '~'> <Id.Lit_Other '+'>}
          spids: [373]
        )
      ]
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {($ Id.VSub_DollarName x)}
                      right: {($ Id.VSub_DollarName PWD)}
                    )
                  redirects: []
                )
              ]
            )
          action: [
            (C {<err_exit>} {<Id.Lit_VarLike 'x='> <Id.Lit_TildeLike '~'> <Id.Lit_Other '+'>} {<not>} 
              {($ Id.VSub_DollarName PWD)}
            )
          ]
          spids: [377 389]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {(word_part.TildeSub token:<Id.Lit_TildeLike '~-'> user_name:-)}
                      right: {($ Id.VSub_DollarName OLDPWD)}
                    )
                  redirects: []
                )
              ]
            )
          action: [(C {<err_exit>} {(SQ <'~'>)} {<not>} {($ Id.VSub_DollarName PWD)})]
          spids: [403 415]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'x='> name:x)
          op: assign_op.Equal
          rhs: {(word_part.TildeSub token:<Id.Lit_TildeLike '~-'> user_name:-)}
          spids: [429]
        )
      ]
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {($ Id.VSub_DollarName x)}
                      right: {($ Id.VSub_DollarName OLDPWD)}
                    )
                  redirects: []
                )
              ]
            )
          action: [
            (C {<err_exit>} {<Id.Lit_VarLike 'x='> <Id.Lit_TildeLike '~-'>} {<not>} 
              {($ Id.VSub_DollarName OLDPWD)}
            )
          ]
          spids: [432 444]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ForEach
      iter_names: [u]
      iterable: (for_iter.Words words:[{<root>} {<Administrator>}])
      body: 
        (command.DoGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'h='> name:h)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<home>} {($ Id.VSub_DollarName u)})
                        right: <Id.Eof_RParen _>
                      )
                    }
                  spids: [469]
                )
              ]
              redirects: []
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_GlobNEqual
                              left: {($ Id.VSub_DollarName h)}
                              right: {<.>}
                            )
                          redirects: []
                        )
                      ]
                    )
                  action: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_ef
                              left: {<Id.Lit_TildeLike '~'> ($ Id.VSub_DollarName u)}
                              right: {($ Id.VSub_DollarName h)}
                            )
                          redirects: []
                        )
                        (C {<err_exit>} 
                          {(DQ <'~'> ($ Id.VSub_DollarName u) <' not '> ($ Id.VSub_DollarName h))}
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'x='> name:x)
                          op: assign_op.Equal
                          rhs: {<Id.Lit_TildeLike '~'> ($ Id.VSub_DollarName u)}
                          spids: [515]
                        )
                      ]
                      redirects: []
                    )
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_ef
                              left: {($ Id.VSub_DollarName x)}
                              right: {($ Id.VSub_DollarName h)}
                            )
                          redirects: []
                        )
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'x='> name:x)
                              op: assign_op.Equal
                              rhs: 
                                {
                                  (DQ <'~'> ($ Id.VSub_DollarName u) <' not '> ($ Id.VSub_DollarName h))
                                }
                              spids: [532]
                            )
                          ]
                          redirects: []
                        )
                      ]
                    )
                    (command.ControlFlow token:<Id.ControlFlow_Break break>)
                  ]
                  spids: [477 490]
                )
              ]
              else_action: []
              redirects: []
            )
          ]
        )
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'x='> name:x)
          op: assign_op.Equal
          rhs: {(word_part.TildeSub token:<Id.Lit_TildeLike '~g.r.emlin'> user_name:g.r.emlin)}
          spids: [548]
        )
      ]
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {($ Id.VSub_DollarName x)}
                      right: {(SQ <'~g.r.emlin'>)}
                    )
                  redirects: []
                )
              ]
            )
          action: [
            (C {<err_exit>} 
              {
                (DQ <'x=~g.r.emlin failed -- expected \'~g.r.emlin\', got \''> 
                  ($ Id.VSub_DollarName x) <'\''>
                )
              }
            )
          ]
          spids: [551 565]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'x='> name:x)
          op: assign_op.Equal
          rhs: 
            {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <Id.Lit_Colon ':'> 
              (word_part.TildeSub token:<Id.Lit_TildeLike '~'>)
            }
          spids: [577]
        )
      ]
      redirects: []
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {($ Id.VSub_DollarName x)}
                      right: {(DQ ($ Id.VSub_DollarName HOME) <':'> ($ Id.VSub_DollarName HOME))}
                    )
                  redirects: []
                )
              ]
            )
          action: [
            (C {<err_exit>} 
              {
                (DQ <'x=~:~ failed, expected \''> ($ Id.VSub_DollarName HOME) <':'> 
                  ($ Id.VSub_DollarName HOME) <'\', got \''> ($ Id.VSub_DollarName x) <'\''>
                )
              }
            )
          ]
          spids: [582 598]
        )
      ]
      else_action: []
      redirects: []
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'HOME='> name:HOME)
          op: assign_op.Equal
          rhs: {<'/'>}
          spids: [614]
        )
      ]
      redirects: []
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.DBracket
          expr: 
            (bool_expr.Binary
              op_id: Id.BoolBinary_GlobDEqual
              left: {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>)}
              right: {<'/'>}
            )
          redirects: []
        )
        (C {<err_exit>} {(SQ <'~ should be /'>)})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.DBracket
          expr: 
            (bool_expr.Binary
              op_id: Id.BoolBinary_GlobDEqual
              left: {(word_part.TildeSub token:<Id.Lit_TildeLike '~'>) <'/foo'>}
              right: {<'/foo'>}
            )
          redirects: []
        )
        (C {<err_exit>} {(SQ <'~/foo should be /foo when ~==/'>)})
      ]
    )
    (command.Simple
      words: [
        {<print>}
        {
          (single_quoted
            left: <Id.Left_DollarSingleQuote '$\''>
            tokens: [
              <Id.Char_Literals 'print ~+'>
              <Id.Char_OneChar '\\n'>
              <Id.Char_Literals '[[ $1 ]] && $0'>
            ]
            right: <Id.Right_SingleQuote '\''>
          )
        }
      ]
      redirects: [
        (redir
          op: <Id.Redir_Great '>'>
          loc: (redir_loc.Fd fd:1)
          arg: {($ Id.VSub_DollarName tmp) <'/tilde'>}
        )
      ]
      more_env: []
      do_fork: T
    )
    (C {<chmod>} {<Id.Lit_Other '+'> <x>} {($ Id.VSub_DollarName tmp) <'/tilde'>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'nl='> name:nl)
          op: assign_op.Equal
          rhs: 
            {
              (single_quoted
                left: <Id.Left_DollarSingleQuote '$\''>
                tokens: [<Id.Char_OneChar '\\n'>]
                right: <Id.Right_SingleQuote '\''>
              )
            }
          spids: [675]
        )
      ]
      redirects: []
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.DBracket
          expr: 
            (bool_expr.Binary
              op_id: Id.BoolBinary_GlobDEqual
              left: 
                {
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: (C {($ Id.VSub_DollarName tmp) <'/tilde'>} {<foo>})
                    right: <Id.Eof_RParen _>
                  )
                }
              right: 
                {(DQ ($ Id.VSub_DollarName PWD) ($ Id.VSub_DollarName nl) ($ Id.VSub_DollarName PWD))}
            )
          redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})]
        )
        (C {<err_exit>} {(SQ <'tilde fails inside a script run by name'>)})
      ]
    )
    (command.ControlFlow
      token: <Id.ControlFlow_Exit exit>
      arg_word: {(word_part.ArithSub anode:($ Id.Lit_ArithVarLike Errors))}
    )
  ]
)