freebsd-dev/tools/regression/bin/sh/errors/redirection-error6.0
Jilles Tjoelker c3bb858966 sh: Do not abort on a redirection error on a compound command.
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
2010-03-14 14:24:35 +00:00

13 lines
381 B
Plaintext

# $FreeBSD$
# A redirection error on a compound command should not abort the shell.
exec 2>/dev/null
{ echo bad; } </var/empty/x
if :; then echo bad; fi </var/empty/x
for i in 1; do echo bad; done </var/empty/x
i=0
while [ $i = 0 ]; do echo bad; i=1; done </var/empty/x
i=0
until [ $i != 0 ]; do echo bad; i=1; done </var/empty/x
case i in *) echo bad ;; esac </var/empty/x
exit 0