Re: Unexpected parse error in function definition involing grouping brac
From:
Greg Wooledge
Subject:
Re: Unexpected parse error in function definition involing grouping braces and redirections
Date:
Tue, 16 Jun 2015 08:58:00 -0400
User-agent:
Mutt/1.4.2.3i
On Tue, Jun 16, 2015 at 01:56:31PM +0200, Michael Le Barbier Grünewald wrote:
> 1>&2 {
> printf "$@"
> printf '\n'
> }
Redirections may appear anywhere in a simple command, but may only appear
at the END of a compound command. Brace grouping is a compound command,
so this is actually a syntax error.
{
printf "$@"
printf '\n'
} 1>&2
would be valid.