(CommandList children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Number "$0")} right: { (BracedVarSub token: <VSub_Name BASH_SOURCE> bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [69 74] ) } ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dirname) op: Equal rhs: { (BracedVarSub token: <VSub_Name BASH_SOURCE> bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ("*")}) spids: [84 92] ) } spids: [83] ) ] spids: [83] ) (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$dirname")} right: {($ VSub_Number "$0")} ) ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:top_dir) op: Equal rhs: {(SQ <..>)} spids: [107] ) ] spids: [107] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:top_dir) op: Equal rhs: {(${ VSub_Name dirname) (/..)} spids: [114] ) ] spids: [114] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (ForEach iter_name: lib_file iter_words: [{(help)} {(alias)}] do_arg_iter: False body: (DoGroup children: [ (Sentence child: (C {(source)} {($ VSub_Name "$top_dir") (/lib/) (${ VSub_Name lib_file) (.sh)}) terminator: <Op_Semi ";"> ) ] spids: [133 145] ) spids: [126 131] ) ] spids: [-1 80] ) ] spids: [-1 147] ) (C {(_Dbg_help_add)} {(SQ <examine>)} { (DQ ("**examine** *expr*\n") ("\n") ("Print value of an expression via ") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (typeset) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (", ") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (let) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (", and failing these,\n") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (eval) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (".\n") ("\n") ("To see the structure of a variable do not prepeand a leading ") (Lit_Other "$") (".\n") ("\n") ("Arithmetic expressions also do not need leading ") (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 ") (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 ") (Lit_Other "$") ("\n") (" declare -a x='([0]=") ) (2) (DQ (" [1]=")) (3) (DQ (" [2]=")) (4) (DQ (")'\n") (" bashdb<2> examine ") ($ VSub_Name "$x") (" # note with ") (Lit_Other "$") ("\n") (" 1 # because this is how bash evaluates ") ($ VSub_Name "$x") ("\n") (" bashdb<3> x p\n") (" declare -ir p=") ) (1) (DQ ("\n") (" bashdb<3> x p+2\n") (" 3\n") (" bashdb<3> x ") ($ VSub_Name "$p") ("+2\n") (" 3\n") ("\n") ("See also:\n") ("---------\n") ("\n") ("**eval** and **pr**.") ) } ) (FuncDef name: _Dbg_do_examine body: (BraceGroup children: [ (C {(typeset)} {(-r)} {(Lit_VarLike "_Dbg_expr=") (BracedVarSub token: <VSub_At "@"> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(DQ ($ VSub_Name "$_Dbg_last_x_args"))} ) spids: [250 256] ) } ) (C {(typeset)} {(_Dbg_result)}) (C {(typeset)} {(Lit_VarLike "isblank=") ($ VSub_Name "$_Dbg_expr")}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id:BoolUnary_z child:{($ VSub_Name "$isblank")}) ) terminator: <Op_Semi ";"> ) ] action: [(C {(_Dbg_msg)} {(DQ ($ VSub_Name "$_Dbg_expr"))})] spids: [-1 282] ) (if_arm cond: [ (Sentence child: (C {(_Dbg_defined)} {($ VSub_Name "$_Dbg_expr")}) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_result) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(typeset)} {(-p)} {($ VSub_Name "$_Dbg_expr")})] ) left_token: <Left_CommandSub "$("> spids: [304 310] ) } spids: [303] ) ] spids: [303] ) (C {(_Dbg_msg)} {(DQ ($ VSub_Name "$_Dbg_result"))}) ] spids: [292 300] ) (if_arm cond: [ (Sentence child: (C {(_Dbg_is_function)} {(DQ ($ VSub_Name "$_Dbg_expr"))} {($ VSub_Name "$_Dbg_set_debug")} ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_result) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(typeset)} {(-f)} {($ VSub_Name "$_Dbg_expr")})] ) left_token: <Left_CommandSub "$("> spids: [335 341] ) } spids: [334] ) ] spids: [334] ) (C {(_Dbg_msg)} {(DQ ($ VSub_Name "$_Dbg_result"))}) ] spids: [320 331] ) ] else_action: [ (C {(typeset)} {(-i)} {(_Dbg_rc)}) (Sentence child: (SimpleCommand words: [{(eval)} {(let)} {(Lit_VarLike "_Dbg_result=") ($ VSub_Name "$_Dbg_expr")}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[368])] ) terminator: <Op_Semi ";"> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_rc) op: Equal rhs: {($ VSub_QMark "$?")} spids: [372] ) ] spids: [372] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_NEqual left: (ArithVarRef name:_Dbg_rc) right: (ArithWord w:{(Lit_Digits 0)}) ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(_Dbg_do_print)} {(DQ ($ VSub_Name "$_Dbg_expr"))})] spids: [-1 391] ) ] else_action: [(C {(_Dbg_msg)} {(DQ ($ VSub_Name "$_Dbg_result"))})] spids: [401 411] ) ] spids: [351 414] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_last_x_args) op: Equal rhs: {(DQ ($ VSub_Name "$_Dbg_x_args"))} spids: [417] ) ] spids: [417] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(0)}) ] spids: [242] ) spids: [238 241] ) (C {(_Dbg_alias_add)} {(SQ <x>)} {(SQ <examine>)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Number "$0")} right: { (BracedVarSub token: <VSub_Name BASH_SOURCE> bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [452 457] ) } ) ) terminator: <Op_Semi ";"> ) ] action: [ (ForEach iter_name: _Dbg_file iter_words: [{(fns)} {(msg)}] do_arg_iter: False body: (DoGroup children: [ (C {(source)} {($ VSub_Name "$top_dir") (/lib/) (${ VSub_Name _Dbg_file) (.sh)}) ] spids: [478 491] ) spids: [471 476] ) (C {(source)} {($ VSub_Name "$top_dir") (/command/help.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_args) op: Equal rhs: {(SQ <examine>)} spids: [500] ) ] spids: [500] ) (C {(_Dbg_do_help)} {(x)}) (C {(_Dbg_do_examine)} {(top_dir)}) ] spids: [-1 463] ) ] spids: [-1 515] ) ] )