Please consider the following bash script:
#!/bin/bash
touch ./temp
set -C
>./temp &>/dev/null # Visible error message output ("./test7: line 7: ./temp: cannot overwrite existing file")
{ >./temp; } &>/dev/null # No error message
Could somebody please explain why the error message which results from the redirection in the next-to-last line is not suppressed by the trailing &>/dev/null, while it works as expected in the last line?
I have studied the paragraphs about redirection and compound commands (notably, the section about group commands) in bash's manual, but couldn't make an explanation out of it. After all, since there is only one command in the curly braces, leaving the braces away shouldn't change anything, should it? Does the difference have to do something with the order in which bash parses lines?