mirror of
https://github.com/opnsense/src.git
synced 2026-04-01 07:25:10 -04:00
Replacing ;; with the new control operator ;& will cause the next list to be executed as well without checking its pattern, continuing until a list ends with ;; or until the end of the case statement. This is like omitting "break" in a C "switch" statement. The sequence ;& was formerly invalid. This feature is proposed for the next POSIX issue in Austin Group issue #449.
39 lines
515 B
Text
39 lines
515 B
Text
# $FreeBSD$
|
|
|
|
errors=0
|
|
|
|
f() {
|
|
result=
|
|
case $1 in
|
|
a) result=${result}a ;;
|
|
b) result=${result}b ;&
|
|
c) result=${result}c ;&
|
|
d) result=${result}d ;;
|
|
e) result=${result}e ;&
|
|
esac
|
|
}
|
|
|
|
check() {
|
|
f "$1"
|
|
if [ "$result" != "$2" ]; then
|
|
printf "For %s, expected %s got %s\n" "$1" "$2" "$result"
|
|
errors=$((errors + 1))
|
|
fi
|
|
}
|
|
|
|
check '' ''
|
|
check a a
|
|
check b bcd
|
|
check c cd
|
|
check d d
|
|
check e e
|
|
|
|
if ! (case 1 in
|
|
1) false ;&
|
|
2) true ;;
|
|
esac) then
|
|
echo "Subshell bad"
|
|
errors=$((errors + 1))
|
|
fi
|
|
|
|
exit $((errors != 0))
|