(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: (BraceGroup children: [ (C {<typeset>} {<-a>} {<Id.Lit_VarLike 'args='> (sh_array_literal left: <Id.Op_LParen _> words: [{($ Id.VSub_At '$@')}] ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_Great left: { (braced_var_sub token: <Id.VSub_Name args> prefix_op: (Id.VSub_Pound) bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) ) } right: {<Id.Lit_Digits 0>} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Case to_match: { (braced_var_sub token: <Id.VSub_Name args> bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>}) ) } arms: [ (case_arm pat_list: [{<off>}] action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_NEqual left: <Id.Lit_ArithVarLike _Dbg_logging> right: {<Id.Lit_Digits 0>} ) ) terminator: <Id.Op_Semi _> ) ] ) 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: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DEqual left: <Id.Lit_ArithVarLike _Dbg_logging> right: {<Id.Lit_Digits 0>} ) ) terminator: <Id.Op_Semi _> ) ] ) 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: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: <Id.Lit_ArithVarLike _Dbg_logging_overwrite> ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [{<cat>} {<'/dev/null'>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$_Dbg_logging_file')} ) ] do_fork: T ) ] 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: <Id.VSub_Number 2> suffix_op: (suffix_op.Unary tok: <Id.VTest_ColonHyphen ':-'> arg_word: {(SQ <on>)} ) ) } ) (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: <Id.Lit_EscapedChar '\\"'> ) <on> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' or '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) <off> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' 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: <Id.VSub_Number 2> suffix_op: (suffix_op.Unary tok: <Id.VTest_ColonHyphen ':-'> arg_word: {(SQ <on>)} ) ) } ) (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: <Id.Lit_EscapedChar '\\"'> ) <on> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' or '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ) <off> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' expected.'> ) } ) ] spids: [410 412 -1 429] ) ] ) ] spids: [346 348 432 -1] ) (case_arm pat_list: [{<file>}] action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DEqual left: { (braced_var_sub token: <Id.VSub_Name args> prefix_op: (Id.VSub_Pound) bracket_op: (bracket_op.WholeArray op_id: Id.Lit_At ) ) } right: {<Id.Lit_Digits 2>} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<_Dbg_write_journal_eval>} { (DQ <'_Dbg_logging_file='> (braced_var_sub token: <Id.VSub_Name args> bracket_op: (bracket_op.ArrayIndex expr: {<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:<Id.ControlFlow_Return return> arg_word:{<0>}) ] ) ) (command.ShFunction name: _Dbg_do_show_logging body: (BraceGroup children: [ (C {<typeset>} {<-a>} {<Id.Lit_VarLike 'args='> (sh_array_literal left: <Id.Op_LParen _> words: [{($ Id.VSub_Star '$*')}] ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DEqual left: { (braced_var_sub token: <Id.VSub_Name args> prefix_op: (Id.VSub_Pound) bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) ) } right: {<Id.Lit_Digits 0>} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<_Dbg_msg>} { (DQ <'Future logs will be written to '> ($ Id.VSub_DollarName '$_Dbg_logging_file') ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: <Id.Lit_ArithVarLike _Dbg_logging_overwrite> ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<_Dbg_msg>} {(SQ <'Logs will overwrite the log file.'>)})] spids: [599 610] ) ] else_action: [ (C {<_Dbg_msg>} {(SQ <'Logs will be appended to the log file.'>)}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: <Id.Lit_ArithVarLike _Dbg_logging_redirect> ) terminator: <Id.Op_Semi _> ) ] ) 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: <Id.VSub_Name args> bracket_op: (bracket_op.ArrayIndex expr:{<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: <Id.Lit_ArithVarLike _Dbg_logging_overwrite> right: {<Id.Lit_Digits 0>} ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:onoff) op: assign_op.Equal rhs: {(SQ <on.>)} 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: <Id.Lit_ArithVarLike _Dbg_logging_redirect> right: {<Id.Lit_Digits 0>} ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:onoff) op: assign_op.Equal rhs: {(SQ <on.>)} 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: <Id.VSub_Name args> bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>}) ) ) } ) ] spids: [794 796 815 -1] ) ] ) ] ) ] ) ) ] )