Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #13747

Function definitions

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From moosotc@gmail.com
Newsgroups gnu.bash.bug
Subject Function definitions
Date Mon, 26 Feb 2018 13:45:16 +0300
Lines 38
Approved bug-bash@gnu.org
Message-ID <mailman.9748.1519654113.27995.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain
X-Trace usenet.stanford.edu 1519654114 31084 208.118.235.17 (26 Feb 2018 14:08:34 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=jfenjip8+98k7PZ3W+AblA5REG9jkbwJ3wTmh5u+X8E=; b=AJfrunP37eQ+j0Wy3VGL3qsogC2gf76sgGVc4oYeoVazWvZYPx+tvKdExT+a3jrcQP 6PJmObQstqfJ9GGtTZAScRyr8TDC5G4duyjXafjQp+hsop6Fceh3o7kzWgiLJVMm7V/S TqUaPO8AnQ2ti8xh6O9r39O1CHbZbF10fIxkR8RurcwaCRLue1kZ+G2Y+4rCIQb9T/7i kfFGnp0ch/qVlE7Y9b+SiZfaYniWWH4UZFxU40MliMo43ZYchJzhHbAHS/wjVQ3xW59r VRcTfSOK4a3Hg+WR7AuYDnidsRPvi9Ac0e75/3c1BvFa3q9fifIOoUDASdW0oai8oMsg VGDg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=jfenjip8+98k7PZ3W+AblA5REG9jkbwJ3wTmh5u+X8E=; b=aMENUyNDbpLTMKTxj688G3W+BEioXeeMEm6OSV0kx5650kU2t4+OGoUOt21y74f2gj tyX9zvhqnQsYo0/HYef1KgZnprfIyqeFa95mw/L5Smu57amFo7PLHPE6hVHOggCSaCOd MVY0irNFIgsd0j6bKyTao91LpQJw6VVE7k4Z+G9a23KHiqFmTLsrxqq+LqAI0+bztK6q Iac8mLHMUZbKtAGAUVMm2391lgbxN3YsWh7KOBS5WSHHIX0sw/IdfUnvl3kLgGNZBaVB /4oj5fLSpVCELlKZcS9WAvYvGgIUeNa94YZOOscrYCKcPG6PhygwhorDDcxLZBkMfd6E OD5Q==
X-Gm-Message-State APf1xPBdqZV+3UfLezNJW7ISncF49RuGCplV5g+iQVWNNDtTjPBEJkW8 iElhnWHSj9lGB9iKKsWIf6dZeA==
X-Google-Smtp-Source AH8x227HumoEZjkraYQrJDIQ7W7Is4PR+IDi+qx1VGWrFMHj5ik2Uz08ozGIUEl7P97OKTYKtvcvJA==
X-Received by 10.46.42.67 with SMTP id q64mr7542344ljq.133.1519641917667; Mon, 26 Feb 2018 02:45:17 -0800 (PST)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2a00:1450:4010:c07::22a
X-Mailman-Approved-At Mon, 26 Feb 2018 09:08:32 -0500
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:13747

Show key headers only | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' -DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS -Wno-parentheses -Wno-format-security
uname output: Linux linmac2 4.15.5-1-ARCH #1 SMP PREEMPT Thu Feb 22 22:15:20 UTC 2018 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

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'

# 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

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Function definitions moosotc@gmail.com - 2018-02-26 13:45 +0300

csiph-web