#!../../bash # Signal handling tests proc child_handler { echo "child handler called" } if [[ "$1"x != x ]] { echo "child process $Pid here..." for (( i=1; i<=1000 ; i++ )) ; do x=`echo b*` for (( j=1; j<=1000 ; j++ )) ; do x=`echo t*` x=`echo *source*` done done exit 1 } # set -x global x := '18' # CHLD handler should not be clobbered by debugger. trap child_handler CHLD kill -INT $Pid kill -INT $Pid exit 0 (CommandList children: [ (FuncDef name: child_handler body: (BraceGroup children:[(C {(echo)} {(DQ ("child handler called"))})] spids:[10]) spids: [6 9] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ ($ VSub_Number "$1")) (x)} right: {(x)} ) ) terminator: ) ] action: [ (C {(echo)} {(DQ ("child process ") ($ VSub_Dollar "$$") (" here..."))}) (ForExpr init: (BinaryAssign op_id: Arith_Equal left: (LhsName name:i) right: (ArithWord w:{(Lit_Digits 1)}) ) cond: (ArithBinary op_id: Arith_LessEqual left: (ArithVarRef name:i) right: (ArithWord w:{(Lit_Digits 1000)}) ) update: (UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i)) body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:x) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(echo)} {(b) (Lit_Other "*")})] ) left_token: spids: [80 85] ) } spids: [79] ) ] spids: [79] ) (ForExpr init: (BinaryAssign op_id: Arith_Equal left: (LhsName name:j) right: (ArithWord w:{(Lit_Digits 1)}) ) cond: (ArithBinary op_id: Arith_LessEqual left: (ArithVarRef name:j) right: (ArithWord w:{(Lit_Digits 1000)}) ) update: (UnaryAssign op_id:Node_PostDPlus child:(LhsName name:j)) body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:x) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(echo)} {(t) (Lit_Other "*")})] ) left_token: spids: [116 121] ) } spids: [115] ) ] spids: [115] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:x) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(echo)} {(Lit_Other "*") (source) (Lit_Other "*")}) ] ) left_token: spids: [125 131] ) } spids: [124] ) ] spids: [124] ) ] spids: [111 134] ) ) ] spids: [75 137] ) ) (C {(exit)} {(1)}) ] spids: [-1 39] ) ] spids: [-1 144] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:x) op:Equal rhs:{(18)} spids:[150])] spids: [150] ) (C {(trap)} {(child_handler)} {(CHLD)}) (C {(kill)} {(-INT)} {($ VSub_Dollar "$$")}) (C {(kill)} {(-INT)} {($ VSub_Dollar "$$")}) (C {(exit)} {(0)}) ] )