opnsense-src/tools/regression/bin/sh/builtins/trap5.0
Jilles Tjoelker a043cc4c68 sh: Fix some things about -- in trap:
* Make 'trap --' do the same as 'trap' instead of nothing.
* Make '--' stop option processing (note that '-' action is not an option).

Side effect: The error message for an unknown option is different.
2011-01-15 21:09:00 +00:00

19 lines
301 B
Text

# $FreeBSD$
set -e
trap - USR1
initial=$(trap)
trap -- -l USR1
added=$(trap)
[ -n "$added" ]
trap - USR1
second=$(trap)
[ "$initial" = "$second" ]
eval "$added"
added2=$(trap)
added3=$(trap --)
[ "$added" = "$added2" ]
[ "$added2" = "$added3" ]
trap -- - USR1
third=$(trap)
[ "$initial" = "$third" ]