Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: moosotc@gmail.com Newsgroups: gnu.bash.bug Subject: Re: Function definitions Date: Mon, 26 Feb 2018 18:24:11 +0300 Lines: 37 Approved: bug-bash@gnu.org Message-ID: References: <877er0qbb7.fsf@gmail.com> <3f544894-f4e2-4c51-9202-6a6e92ae8ebb@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: usenet.stanford.edu 1519658662 733 208.118.235.17 (26 Feb 2018 15:24:22 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Chet Ramey Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=/j8utsiNjSWlJcUqgJ1nbhJtIQWFcK0P/r1bUVg18as=; b=VHWtwZo4nz740KFZbENtX3DjNOHT/ONLd980ph2L2tCEgpv/6BYwecEG6lTUiKf0i6 zQXawM9YFqqzPn7wlIg7t1Nkq2fZUNDdcmiuK+5pCp8oZkMB+H7iZlJXhPpGONAY3wqQ WTOskIB6ThFM0+Ad65bK59hsJico6/W8s1BkxlAMV7iAShkrlLXDEzf56g6ONiM6blnD zoYb/hDwTAM7gN+GhuT9nyUGc2eBCwUqRpxsjlKq3WbtCSH8wWSk3oXvEBl8WInMPPpO 0eYK3XDHNutdJ05xBKcZJ1Fcz51kmTqjzj83pDiEYHg7RcmMwfULdczZax8oazF68Lbi NsTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=/j8utsiNjSWlJcUqgJ1nbhJtIQWFcK0P/r1bUVg18as=; b=GXchUu9lKPt3f7s/jdiZQ1cA7KGcrRpVtkcQh2ULXBViJ3SwItOcF9MhGnOS4om/RA GqEYcXZf6gfwa2LXv1iRMG+Dq2S5VHqDOGb6Z1Ar9CyR0ZLGEgSFfbII7kYLT4xv1SV3 7Ypc6FcEYl25xzftraxkDEBd/8ytnfg/nFOwwIRHd90r6C9T3KrT3bCehnsJeViml4Dc UO4Rqn5JbaHDKJVLGODpYjDqPxGVorW81PCEzpb+/JKUEtNMUMJqrZ/N2ZSDx5KPniD+ WXUZAIBrOZ4vpdCSQvX5s1sJbGgmOEbEdtkdDaiwWLnH4Rtw9YPl9tMx+tpz3DsD/nj/ PjRA== X-Gm-Message-State: APf1xPAfnDglL+QmLgTUF3lMD6AmZxF5o1TAky+YBWnPVyz2BbOPEGaN pXTlxKKZtvziZ4W77js695Upqg== X-Google-Smtp-Source: AG47ELuED7k4jeV6971HbYkR589ea4wMTPiM76HFQnPU6U4NahMXRRSjXn8ycaALy8CO7FgSrIutDA== X-Received: by 10.46.93.148 with SMTP id v20mr7556596lje.34.1519658653520; Mon, 26 Feb 2018 07:24:13 -0800 (PST) In-Reply-To: <3f544894-f4e2-4c51-9202-6a6e92ae8ebb@case.edu> (Chet Ramey's message of "Mon, 26 Feb 2018 09:20:55 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::231 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:13752 Chet Ramey writes: > On 2/26/18 5:45 AM, moosotc@gmail.com wrote: > >> Bash Version: 4.4 >> Patch Level: 19 >> Release Status: release >> >> Description: >> Bash rejects valid function definitions >> >> Repeat-By: >> >> $ func() true >> bash: syntax error near unexpected token `true' > > Yes, bash requires that function bodies be compound commands, as the Posix > grammar specifies. > >> # Variant#2 >> $ func() { true } >>> ^C > > This is not a valid compound command. To be recognized as a reserved word, > and end the group command, the close brace must appear in a context where > a reserved word is valid. The argument to a simple command is not such a > place. Thank you for an explanation. My takeaway is that most, if not all, [kaz]sh descendants[1] allow something that IEEE Std 1003.1-2008, 2016 Edition doesn't. [1] dash,busybox,mksh,zsh -- mailto:moosotc@gmail.com