Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #13753 > unrolled thread
| Started by | moosotc@gmail.com |
|---|---|
| First post | 2018-02-26 18:26 +0300 |
| Last post | 2018-02-26 18:26 +0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Function definitions moosotc@gmail.com - 2018-02-26 18:26 +0300
| From | moosotc@gmail.com |
|---|---|
| Date | 2018-02-26 18:26 +0300 |
| Subject | Re: Function definitions |
| Message-ID | <mailman.9755.1519658824.27995.bug-bash@gnu.org> |
Pierre Gaston <pierre.gaston@gmail.com> writes:
> On Mon, Feb 26, 2018 at 12:45 PM, <moosotc@gmail.com> wrote:
>
[..snip..]
>>
>> $ func() true
>> bash: syntax error near unexpected token `true'
>>
>> # Variant#2
>> $ func() { true }
>> > ^C
>>
>> Both forms seem to be valid per [1] and are accepted by (at least)
>> ash, zsh and mksh
>>
>> Worth noting that the Variant#2 can be made to work in bash with an
>> addition
>> of a semicolon:
>>
>> $ func() { true; }
>>
>> [1] http://pubs.opengroup.org/onlinepubs/9699919799/
>> utilities/V3_chap02.html
>>
>> --
>> mailto:moosotc@gmail.com
>>
>>
> On the contrary SUS doesn't define either one, as function definition
> requires a compound command
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05
>
> and it requires a delimiter in compound commands
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04
Thanks.
--
mailto:moosotc@gmail.com
Back to top | Article view | gnu.bash.bug
csiph-web