bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function definitions


From: moosotc
Subject: Re: Function definitions
Date: Mon, 26 Feb 2018 18:26:55 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Pierre Gaston <address@hidden> writes:

> On Mon, Feb 26, 2018 at 12:45 PM, <address@hidden> 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:address@hidden
>>
>>
> 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:address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]