(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 ops: [Op_DAmp Op_DPipe] children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name '$dirname')} right: {($ VSub_Number '$0')} ) ) (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] ) ] ) (ForEach iter_name: lib_file iter_words: [{(help)} {(alias)}] do_arg_iter: F 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: [16777215 80] ) ] spids: [16777215 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: [ (Assignment keyword: Assign_Typeset flags: [-r] pairs: [ (assign_pair lhs: (LhsName name:_Dbg_expr) op: Equal rhs: { (BracedVarSub token: <VSub_At '@'> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(DQ ($ VSub_Name '$_Dbg_last_x_args'))} ) spids: [250 256] ) } spids: [249] ) ] spids: [245] ) (Assignment keyword: Assign_Typeset pairs: [(assign_pair lhs:(LhsName name:_Dbg_result) op:Equal spids:[261])] spids: [259] ) (Assignment keyword: Assign_Typeset pairs: [ (assign_pair lhs: (LhsName name:isblank) op: Equal rhs: {($ VSub_Name '$_Dbg_expr')} spids: [266] ) ] spids: [264] ) (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: [16777215 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 {(Assign_Typeset 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 {(Assign_Typeset 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: [ (Assignment keyword: Assign_Typeset flags: [-i] pairs: [(assign_pair lhs:(LhsName name:_Dbg_rc) op:Equal spids:[358])] spids: [354] ) (Sentence child: (SimpleCommand words: [{(eval)} {(let)} {(Lit_VarLike '_Dbg_result=') ($ VSub_Name '$_Dbg_expr')}] redirects: [(Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})] ) 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)}) ) spids: [378 387] ) terminator: <Op_Semi ';'> ) ] action: [(C {(_Dbg_do_print)} {(DQ ($ VSub_Name '$_Dbg_expr'))})] spids: [16777215 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: F 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: [16777215 463] ) ] spids: [16777215 515] ) ] )