File: trap_handling

package info (click to toggle)
shellia 5.10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 792 kB
  • sloc: sh: 7,840; makefile: 34
file content (20 lines) | stat: -rw-r--r-- 183 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
set -u
set -e

f1()
{
  echo "f1: show trap:" >&2
  trap >&2
}

f2()
{
  trap "/bin/echo f2" EXIT
}


trap "/bin/echo main" EXIT

echo "f1 output: <$(f1)>"
echo "f2 output: <$(f2)>"