~elementary-os/elementaryos/os-patch-bash-bionic

« back to all changes in this revision

Viewing changes to tests/dbg-support2.tests

  • Committer: RabbitBot
  • Date: 2018-02-05 12:45:41 UTC
  • Revision ID: rabbitbot@elementary.io-20180205124541-5wicxd8ktiog8uh1
Initial import, version 4.4-5ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!../bash
 
2
#
 
3
# Test correct trap return codes = 2 means skip execution.
 
4
shopt -s extdebug
 
5
print_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
 
 
14
debug_exit=0
 
15
trap 'print_trap $LINENO' DEBUG
 
16
 
 
17
x=1
 
18
echo "x is $x"
 
19
debug_exit=2
 
20
x=2
 
21
echo "x is $x"
 
22
 
 
23
#;;; Local Variables: ***
 
24
#;;; mode:shell-script ***
 
25
#;;; eval: (sh-set-shell "bash") ***
 
26
#;;; End: ***