mirror of
https://github.com/opnsense/src.git
synced 2026-02-25 02:42:54 -05:00
Redirection errors on subshells already did not abort the shell because
the redirection is executed in the subshell.
Other shells seem to agree that these redirection errors should not abort
the shell.
Also ensure that the redirections will be cleaned up properly in cases like
command eval '{ shift x; } 2>/dev/null'
Example:
{ echo bad; } </var/empty/x; echo good
14 lines
220 B
Text
14 lines
220 B
Text
# $FreeBSD$
|
|
|
|
failures=0
|
|
|
|
check() {
|
|
if ! eval "[ $* ]"; then
|
|
echo "Failed: $*"
|
|
: $((failures += 1))
|
|
fi
|
|
}
|
|
|
|
check '"$({ command eval \{ shift x\; \} 2\>/dev/null; } >/dev/null; echo hi)" = hi'
|
|
|
|
exit $((failures > 0))
|