summaryrefslogtreecommitdiffstats
path: root/tests/varenv22.sub
blob: 6d42bb57023d2f54f11c341775a0c66c65d00559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# test behavior of FUNCNAME in and out of parse_and_execute scenarios

# in parse_and_execute
${THIS_SH} -c 'trap "echo trap:\$FUNCNAME" EXIT ; trap ; f() { exit; } ; f' bash

${THIS_SH} << \EOF
eval "trap 'echo trap:\$FUNCNAME' EXIT ; trap; f() { exit; } ; f"
EOF

# not in parse_and_execute
${THIS_SH} << \EOF
trap 'echo trap:$FUNCNAME' EXIT ; trap; f() { exit; } ; f
EOF

# this has to be last
trap 'echo trap:$FUNCNAME' EXIT ; trap; f() { exit; } ; f