(command.CommandList children: [ (C {(typeset)} {(-i)} {(Id.Lit_VarLike '_Dbg_logging=') (0)}) (C {(typeset)} {(Id.Lit_VarLike '_Dbg_logging_file=') (DQ (bashdb.txt))}) (C {(typeset)} {(Id.Lit_VarLike '_Dbg_logging_overwrite=') (0)}) (C {(typeset)} {(Id.Lit_VarLike '_Dbg_logging_redirect=') (0)}) (command.ShFunction name: _Dbg_do_set_logging body: (command.BraceGroup children: [ (C {(typeset)} {(-a)} {(Id.Lit_VarLike 'args=') (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:120) words: [{($ Id.VSub_At '$@')}] ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_Great left: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:args span_id:131) prefix_op: (Id.VSub_Pound) bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) ) } ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:144) ) ] action: [ (command.Case to_match: { (braced_var_sub token: (Token id:Id.VSub_Name val:args span_id:152) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) } arms: [ (case_arm pat_list: [{(off)}] action: [ (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_logging span_id: 171 ) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:180) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_Dbg_logging) op: assign_op.Equal rhs: {(0)} spids: [189] ) ] ) ] spids: [167 182] ) ] ) ] spids: [162 164 196 -1] ) (case_arm pat_list: [{(on)}] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DEqual left: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: _Dbg_logging span_id: 208 ) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:217) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:_Dbg_logging) op: assign_op.Equal rhs: {(1)} spids: [222] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: _Dbg_logging_overwrite span_id: 230 ) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:235) ) ] action: [ (command.Simple words: [{(cat)} {(/dev/null)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:244) fd: -1 arg_word: {($ Id.VSub_DollarName '$_Dbg_logging_file')} ) ] ) ] spids: [226 237] ) ] ) ] spids: [204 219] ) ] ) ] spids: [199 201 254 -1] ) (case_arm pat_list: [{(overwrite)}] action: [ (C {(local)} {(Id.Lit_VarLike 'onoff=') (braced_var_sub token: (Token id:Id.VSub_Number val:2 span_id:266) suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {(SQ (Token id:Id.Lit_Chars val:on span_id:269))} ) ) } ) (command.Case to_match: {($ Id.VSub_DollarName '$onoff')} arms: [ (case_arm pat_list: [{(on)} {(1)}] action: [ (C {(_Dbg_write_journal_eval)} {(DQ ('_Dbg_logging_overwrite=1'))}) ] spids: [282 288 299 -1] ) (case_arm pat_list: [{(off)} {(0)}] action: [ (C {(_Dbg_write_journal_eval)} {(DQ ('_Dbg_logging_overwrite=0'))}) ] spids: [302 308 318 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(_Dbg_msg)} { (DQ (word_part.EscapedLiteral token: (Token id: Id.Lit_EscapedChar val: '\\"' span_id: 329 ) ) (on) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:331)) (' or ') (word_part.EscapedLiteral token: (Token id: Id.Lit_EscapedChar val: '\\"' span_id: 333 ) ) (off) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:335)) (' expected.') ) } ) ] spids: [321 323 -1 340] ) ] ) ] spids: [257 259 343 -1] ) (case_arm pat_list: [{(redirect)}] action: [ (C {(local)} {(Id.Lit_VarLike 'onoff=') (braced_var_sub token: (Token id:Id.VSub_Number val:2 span_id:355) suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {(SQ (Token id:Id.Lit_Chars val:on span_id:358))} ) ) } ) (command.Case to_match: {($ Id.VSub_DollarName '$onoff')} arms: [ (case_arm pat_list: [{(on)} {(1)}] action: [ (C {(_Dbg_write_journal_eval)} {(DQ ('_Dbg_logging_redirect=1'))}) ] spids: [371 377 388 -1] ) (case_arm pat_list: [{(off)} {(0)}] action: [ (C {(_Dbg_write_journal_eval)} {(DQ ('_Dbg_logging_redirect=0'))}) ] spids: [391 397 407 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(_Dbg_msg)} { (DQ (word_part.EscapedLiteral token: (Token id: Id.Lit_EscapedChar val: '\\"' span_id: 418 ) ) (on) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:420)) (' or ') (word_part.EscapedLiteral token: (Token id: Id.Lit_EscapedChar val: '\\"' span_id: 422 ) ) (off) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:424)) (' expected.') ) } ) ] spids: [410 412 -1 429] ) ] ) ] spids: [346 348 432 -1] ) (case_arm pat_list: [{(file)}] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DEqual left: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id: Id.VSub_Name val: args span_id: 446 ) prefix_op: (Id.VSub_Pound) bracket_op: (bracket_op.WholeArray op_id: Id.Lit_At ) ) } ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 2)}) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:459) ) ] action: [ (C {(_Dbg_write_journal_eval)} { (DQ ('_Dbg_logging_file=') (braced_var_sub token: (Token id:Id.VSub_Name val:args span_id:469) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) ) } ) ] spids: [440 461] ) ] else_action: [ (C {(_Dbg_msg)} {(DQ ("Expecting a single file argument in 'set logging file'."))} ) ] ) ] spids: [435 437 491 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(_Dbg_msg)} {(DQ ('Usage: set logging on'))}) (C {(_Dbg_msg)} {(DQ ('set logging off'))}) (C {(_Dbg_msg)} {(DQ ('set logging file FILENAME'))}) (C {(_Dbg_msg)} {(DQ ('set logging overwrite [on|off]'))}) (C {(_Dbg_msg)} {(DQ ('set logging redirect [on|off]'))}) ] spids: [494 496 534 -1] ) ] ) ] spids: [125 146] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:543) arg_word: {(0)} ) ] ) ) (command.ShFunction name: _Dbg_do_show_logging body: (command.BraceGroup children: [ (C {(typeset)} {(-a)} {(Id.Lit_VarLike 'args=') (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:562) words: [{($ Id.VSub_Star '$*')}] ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DEqual left: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:args span_id:573) prefix_op: (Id.VSub_Pound) bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) ) } ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:586) ) ] action: [ (C {(_Dbg_msg)} { (DQ ('Future logs will be written to ') ($ Id.VSub_DollarName '$_Dbg_logging_file') ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: _Dbg_logging_overwrite span_id: 603 ) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:608) ) ] action: [ (C {(_Dbg_msg)} { (SQ (Token id: Id.Lit_Chars val: 'Logs will overwrite the log file.' span_id: 616 ) ) } ) ] spids: [599 610] ) ] else_action: [ (C {(_Dbg_msg)} { (SQ (Token id: Id.Lit_Chars val: 'Logs will be appended to the log file.' span_id: 626 ) ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: _Dbg_logging_redirect span_id: 634 ) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:639) ) ] action: [ (C {(_Dbg_msg)} {(DQ ('Output will be sent only to the log file.'))}) ] spids: [630 641] ) ] else_action: [(C {(_Dbg_msg)} {(DQ ('Output will be logged and displayed.'))})] ) ] ) ] spids: [567 588] ) ] else_action: [ (command.Case to_match: { (braced_var_sub token: (Token id:Id.VSub_Name val:args span_id:673) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) } arms: [ (case_arm pat_list: [{(overwrite)}] action: [ (C {(local)} {(Id.Lit_VarLike 'onoff=') (DQ (off.))}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.Binary op_id: Id.Arith_NEqual left: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: _Dbg_logging_overwrite span_id: 698 ) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:onoff) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:on. span_id:711))} spids: [709] ) ] ) ] ) (C {(_Dbg_msg)} { (DQ ('Whether logging overwrites or appends to the log file is ') (${ Id.VSub_Name onoff) ) } ) ] spids: [683 685 727 -1] ) (case_arm pat_list: [{(redirect)}] action: [ (C {(local)} {(Id.Lit_VarLike 'onoff=') (DQ (off.))}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.Binary op_id: Id.Arith_NEqual left: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: _Dbg_logging_redirect span_id: 745 ) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:onoff) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:on. span_id:758))} spids: [756] ) ] ) ] ) (C {(_Dbg_msg)} {(DQ ('The logging output mode is ') (${ Id.VSub_Name onoff) (.))} ) ] spids: [730 732 773 -1] ) (case_arm pat_list: [{(file)}] action: [ (C {(_Dbg_msg)} {(DQ ('The current logfile is ') (${ Id.VSub_Name _Dbg_logging_file))} ) ] spids: [776 778 791 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(_Dbg_undefined_cmd)} {(DQ ('show logging'))} { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:args span_id:807) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) ) } ) ] spids: [794 796 815 -1] ) ] ) ] ) ] ) ) ] )