[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:48:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Michael Le Barbier Grünewald <michael@quintly.com> writes:
> Nevertheless, when evaluating the second snippet
>
> failwith()
> {
> 1>&2 {
> printf 'Failure: '
> printf "$@"
> printf '\n'
> }
> exit 1
> }
>
> bash does not report the syntax error and resumes interpretation,
This is fully syntactical. It defines a function, then exits with 1
(ignoring the rest of the input). Braces are not special characters,
only recognized as reserved words in some contexts.
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."