1#!../bash
2#
3# Test correct trap return codes = 2 means skip execution.
4shopt -s extdebug
5print_trap() {
6   echo "lineno: $1 ($LINENO) ${FUNCNAME[1]}"
7   if [[ $debug_exit == 2 ]] ; then
8     debug_exit=0
9     return 2
10   fi
11   return 0
12}
13
14debug_exit=0
15trap 'print_trap $LINENO' DEBUG
16
17x=1
18echo "x is $x"
19debug_exit=2
20x=2
21echo "x is $x"
22
23#;;; Local Variables: ***
24#;;; mode:shell-script ***
25#;;; eval: (sh-set-shell "bash") ***
26#;;; End: ***
27