(command.CommandList children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_Number '$0')} right: { (braced_var_sub token: (Token id:Id.VSub_Name val:BASH_SOURCE span_id:70) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:78) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:dirname) op: assign_op.Equal rhs: { (braced_var_sub token: (Token id:Id.VSub_Name val:BASH_SOURCE span_id:85) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) suffix_op: (suffix_op.Unary op_id: Id.VOp1_Percent arg_word: {(Id.Lit_Slash /) ('*')} ) ) } spids: [83] ) ] ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DPipe] children: [ (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$dirname')} right: {($ Id.VSub_Number '$0')} ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:top_dir) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:.. span_id:109))} spids: [107] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:top_dir) op: assign_op.Equal rhs: {(${ Id.VSub_Name dirname) (/..)} spids: [114] ) ] ) ] ) (command.ForEach iter_name: lib_file iter_words: [{(help)} {(alias)}] do_arg_iter: F body: (command.DoGroup children: [ (command.Sentence child: (C {(source)} {($ Id.VSub_DollarName '$top_dir') (/lib/) (${ Id.VSub_Name lib_file) (.sh)} ) terminator: (Token id:Id.Op_Semi val:';' span_id:143) ) ] ) ) ] spids: [61 80] ) ] ) (C {(_Dbg_help_add)} {(SQ (Token id:Id.Lit_Chars val:examine span_id:153))} { (DQ ('**examine** *expr*\n') ('\n') ('Print value of an expression via ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:161) ) (typeset) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:163)) (', ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:165) ) (let) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:167)) (', and failing these,\n') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:169)) (eval) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:171) ) ('.\n') ('\n') ('To see the structure of a variable do not prepeand a leading ') (Id.Lit_Other '$') ('.\n') ('\n') ('Arithmetic expressions also do not need leading ') (Id.Lit_Other '$') (' for\n') ('their value is to be substituted.\n') ('\n') ('However if *expr* falls into neither these, categories variables\n') ('witih *expr* need ') (Id.Lit_Other '$') (' to have their value substituted.\n') ('\n') ('Examples:\n') ('---------\n') ('\n') (' # code:\n') (' # typeset -a typeset -a x=(2 3 4)\n') (' # typeset -ir p=1\n') (' bashdb<1> examine x # note no ') (Id.Lit_Other '$') ('\n') (" declare -a x='([0]=") ) (2) (DQ (' [1]=')) (3) (DQ (' [2]=')) (4) (DQ (")'\n") (' bashdb<2> examine ') ($ Id.VSub_DollarName '$x') (' # note with ') (Id.Lit_Other '$') ('\n') (' 1 # because this is how bash evaluates ') ($ Id.VSub_DollarName '$x') ('\n') (' bashdb<3> x p\n') (' declare -ir p=') ) (1) (DQ ('\n') (' bashdb<3> x p+2\n') (' 3\n') (' bashdb<3> x ') ($ Id.VSub_DollarName '$p') ('+2\n') (' 3\n') ('\n') ('See also:\n') ('---------\n') ('\n') ('**eval** and **pr**.') ) } ) (command.ShFunction name: _Dbg_do_examine body: (command.BraceGroup children: [ (C {(typeset)} {(-r)} {(Id.Lit_VarLike '_Dbg_expr=') (braced_var_sub token: (Token id:Id.VSub_At val:'@' span_id:251) suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {(DQ ($ Id.VSub_DollarName '$_Dbg_last_x_args'))} ) ) } ) (C {(typeset)} {(_Dbg_result)}) (C {(typeset)} {(Id.Lit_VarLike 'isblank=') ($ Id.VSub_DollarName '$_Dbg_expr')}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_z child: {($ Id.VSub_DollarName '$isblank')} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:280) ) ] action: [(C {(_Dbg_msg)} {(DQ ($ Id.VSub_DollarName '$_Dbg_expr'))})] spids: [270 282] ) (if_arm cond: [ (command.Sentence child: (C {(_Dbg_defined)} {($ Id.VSub_DollarName '$_Dbg_expr')}) terminator: (Token id:Id.Op_Semi val:';' span_id:298) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_Dbg_result) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:304) command_list: (command.CommandList children: [ (C {(typeset)} {(-p)} {($ Id.VSub_DollarName '$_Dbg_expr')}) ] ) ) } spids: [303] ) ] ) (C {(_Dbg_msg)} {(DQ ($ Id.VSub_DollarName '$_Dbg_result'))}) ] spids: [292 300] ) (if_arm cond: [ (command.Sentence child: (C {(_Dbg_is_function)} {(DQ ($ Id.VSub_DollarName '$_Dbg_expr'))} {($ Id.VSub_DollarName '$_Dbg_set_debug')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:329) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_Dbg_result) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:335) command_list: (command.CommandList children: [ (C {(typeset)} {(-f)} {($ Id.VSub_DollarName '$_Dbg_expr')}) ] ) ) } spids: [334] ) ] ) (C {(_Dbg_msg)} {(DQ ($ Id.VSub_DollarName '$_Dbg_result'))}) ] spids: [320 331] ) ] else_action: [ (C {(typeset)} {(-i)} {(_Dbg_rc)}) (command.Sentence child: (command.Simple words: [ {(eval)} {(let)} {(Id.Lit_VarLike '_Dbg_result=') ($ Id.VSub_DollarName '$_Dbg_expr')} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:368) fd: 2 arg_word: {(/dev/null)} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:370) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_Dbg_rc) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [372] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_NEqual left: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:_Dbg_rc span_id:380) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:389) ) ] action: [(C {(_Dbg_do_print)} {(DQ ($ Id.VSub_DollarName '$_Dbg_expr'))})] spids: [376 391] ) ] else_action: [(C {(_Dbg_msg)} {(DQ ($ Id.VSub_DollarName '$_Dbg_result'))})] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_Dbg_last_x_args) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$_Dbg_x_args'))} spids: [417] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:423) arg_word: {(0)} ) ] ) ) (C {(_Dbg_alias_add)} {(SQ (Token id:Id.Lit_Chars val:x span_id:433))} {(SQ (Token id:Id.Lit_Chars val:examine span_id:437))} ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_Number '$0')} right: { (braced_var_sub token: (Token id:Id.VSub_Name val:BASH_SOURCE span_id:453) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:461) ) ] action: [ (command.ForEach iter_name: _Dbg_file iter_words: [{(fns)} {(msg)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(source)} {($ Id.VSub_DollarName '$top_dir') (/lib/) (${ Id.VSub_Name _Dbg_file) (.sh)} ) ] ) ) (C {(source)} {($ Id.VSub_DollarName '$top_dir') (/command/help.sh)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_Dbg_args) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:examine span_id:502))} spids: [500] ) ] ) (C {(_Dbg_do_help)} {(x)}) (C {(_Dbg_do_examine)} {(top_dir)}) ] spids: [444 463] ) ] ) ] )