(command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ (${ Id.VSub_Name __mal_env_included__))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:__mal_env_included) op: assign_op.Equal rhs: {<true>} spids: [27] ) ] ) (C {<source>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<dirname>} {($ Id.VSub_Number '$0')}) ) <'/types.sh'> } ) (command.ShFunction name: ENV body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: (word.Empty) spids: [55] ) ] ) (C {<_hash_map>}) (C {<local>} {<Id.Lit_VarLike 'env='> (DQ (${ Id.VSub_Name r))}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.WordTest w:{(DQ (${ Id.VSub_Number 1))}) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:outer) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 1))} spids: [87] ) ] ) terminator: <Id.Op_Semi _> ) (C {<shift>}) (C {<_assoc> <Id.KW_Bang '!'>} {(DQ (${ Id.VSub_Name env))} {(DQ <__outer__>)} {(DQ (${ Id.VSub_Name outer))} ) ] spids: [71 84] ) ] else_action: [ (C {<_assoc> <Id.KW_Bang '!'>} {(DQ (${ Id.VSub_Name env))} {(DQ <__outer__>)} {(DQ (${ Id.VSub_Name __nil))} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name env))} spids: [144] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.LogicalAnd left: (bool_expr.WordTest w:{(DQ (${ Id.VSub_Number 1))}) right: (bool_expr.WordTest w:{(DQ (${ Id.VSub_At '@'))}) ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Sentence child: (C {<local>} {<Id.Lit_VarLike 'binds='> (sh_array_literal left: <Id.Op_LParen _> words: [ { (braced_var_sub token: <Id.VSub_Name ANON> bracket_op: (bracket_op.ArrayIndex expr: {(DQ (${ Id.VSub_Number 1))} ) ) } ] ) } ) terminator: <Id.Op_Semi _> ) (C {<shift>}) (C {<local>} {<Id.Lit_VarLike 'idx='> <0>}) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.WordTest w: { (DQ (braced_var_sub token: <Id.VSub_Name binds> bracket_op: (bracket_op.ArrayIndex expr: {(DQ (${ Id.VSub_Name idx))} ) ) ) } ) ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (C {<local>} {<Id.Lit_VarLike 'fp='> (DQ (braced_var_sub token: <Id.VSub_Name ANON> bracket_op: (bracket_op.ArrayIndex expr: { (DQ (braced_var_sub token: <Id.VSub_Name binds> bracket_op: (bracket_op.ArrayIndex expr: {(DQ (${ Id.VSub_Name idx))} ) ) ) } ) ) ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ (${ Id.VSub_Name fp))} right: {(DQ <'&'>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:idx) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: <Id.Lit_ArithVarLike idx> right: {<Id.Lit_Digits 1>} ) ) } spids: [272] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:fp) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: <Id.VSub_Name ANON> bracket_op: (bracket_op.ArrayIndex expr: { (DQ (braced_var_sub token: <Id.VSub_Name binds> bracket_op: (bracket_op.ArrayIndex expr: {(DQ (${ Id.VSub_Name idx))} ) ) ) } ) ) ) } spids: [285] ) ] ) (C {<_list>} {(DQ (${ Id.VSub_At '@'))}) (C {<_assoc> <Id.KW_Bang '!'>} {(DQ (${ Id.VSub_Name env))} {(DQ (${ Id.VSub_Name fp))} {(DQ (${ Id.VSub_Name r))} ) (command.ControlFlow token: <Id.ControlFlow_Break break> ) ] spids: [250 269] ) ] else_action: [ (C {<_assoc> <Id.KW_Bang '!'>} {(DQ (${ Id.VSub_Name env))} {(DQ (${ Id.VSub_Name fp))} {(DQ (${ Id.VSub_Number 1))} ) (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:idx) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: <Id.Lit_ArithVarLike idx> right: {<Id.Lit_Digits 1>} ) ) } spids: [369] ) ] ) ] ) ] ) ) ] spids: [153 174] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name env))} spids: [391] ) ] ) ] ) ) (command.ShFunction name: ENV_FIND body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<_contains> <Id.Lit_QMark '?'>} {(DQ (${ Id.VSub_Number 1))} { (DQ (braced_var_sub token: <Id.VSub_Name ANON> bracket_op: (bracket_op.ArrayIndex expr: {(DQ (${ Id.VSub_Number 2))} ) ) ) } ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 1))} spids: [440] ) ] ) ] spids: [412 437] ) ] else_action: [ (C {<local>} {<Id.Lit_VarLike 'obj='> (DQ (braced_var_sub token: <Id.VSub_Name ANON> bracket_op: (bracket_op.ArrayIndex expr:{(DQ (${ Id.VSub_Number 1))}) ) ) } ) (C {<eval>} {<local>} {<Id.Lit_VarLike 'outer='> (DQ (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'{'> (${ Id.VSub_Name obj) <'['> ) <__outer__> (DQ <']}'>) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.LogicalAnd left: (bool_expr.WordTest w:{(DQ (${ Id.VSub_Name outer))}) right: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {(DQ (${ Id.VSub_Name outer))} right: {(DQ (${ Id.VSub_Name __nil))} ) ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<ENV_FIND>} {(DQ (${ Id.VSub_Name outer))} {(DQ (${ Id.VSub_Number 2))}) ] spids: [487 516] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: (word.Empty) spids: [537] ) ] ) ] ) ] ) ] ) ) (command.ShFunction name: ENV_GET body: (BraceGroup children: [ (C {<ENV_FIND>} {(DQ (${ Id.VSub_Number 1))} {(DQ (${ Id.VSub_Number 2))}) (C {<local>} {<Id.Lit_VarLike 'env='> (DQ (${ Id.VSub_Name r))}) (C {<local>} {<Id.Lit_VarLike 'key='> (DQ (braced_var_sub token: <Id.VSub_Name ANON> bracket_op: (bracket_op.ArrayIndex expr:{(DQ (${ Id.VSub_Number 2))}) ) ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.WordTest w:{(DQ (${ Id.VSub_Name r))}) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<local>} {<Id.Lit_VarLike 'obj='> (DQ (braced_var_sub token: <Id.VSub_Name ANON> bracket_op: (bracket_op.ArrayIndex expr:{(DQ (${ Id.VSub_Name env))}) ) ) } ) (C {<eval>} {<Id.Lit_VarLike 'r='> (DQ (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <'{'> (${ Id.VSub_Name obj) <'['> ) (${ Id.VSub_Name key) (DQ <']}'>) } ) ] spids: [607 620] ) ] else_action: [(C {<_error>} {(DQ <'\''> (${ Id.VSub_Name key) <'\' not found'>)})] ) ] ) ) (command.ShFunction name: ENV_SET body: (BraceGroup children: [ (C {<local>} {<Id.Lit_VarLike 'key='> (DQ (braced_var_sub token: <Id.VSub_Name ANON> bracket_op: (bracket_op.ArrayIndex expr:{(DQ (${ Id.VSub_Number 2))}) ) ) } ) (C {<_assoc> <Id.KW_Bang '!'>} {(DQ (${ Id.VSub_Number 1))} {(DQ (${ Id.VSub_Name key))} {(DQ (${ Id.VSub_Number 3))} ) ] ) ) ] spids: [10 25] ) ] )