[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected parse error in function definition involing grouping brac
From: |
Andreas Schwab |
Subject: |
Re: Unexpected parse error in function definition involing grouping braces and redirections |
Date: |
Tue, 16 Jun 2015 15:27:18 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Greg Wooledge <wooledg@eeg.ccf.org> writes:
> 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.
Not so much a syntax error, since { is not special except as the first
word, so this is just a command-not-found error.
$ 1>&2 {
bash: {: command not found
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."