Bug 32830

Summary: Parser problem with functions
Product: [Retired] Red Hat Linux Reporter: Marco Colombo <marco>
Component: bashAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: low Docs Contact:
Priority: medium    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-03-23 16:42:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marco Colombo 2001-03-23 16:42:03 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.17-14 i686)


bash-2.04$ bash -c "hwhois() { fwhois $1.net }"
bash: -c: line 2: syntax error: unexpected end of file

it works with bash v1.14.7(1); bash 2 wants:
bash-2.04$ bash -c "hwhois() { fwhois $1.net; }"  (note the
semi-colon)

If you split the function definition on more lines (with the closing
bracket on its own) it works as expected (no extra semicolon required).
This breaks some scripts here. I can't tell which one is correct, but I
believe compatibility is a issue (more than parser strict adherence to
formal grammar).

Reproducible: Always
Steps to Reproduce:
(see above)

Comment 1 Bernhard Rosenkraenzer 2001-03-25 14:04:10 UTC
bash 2.x is correct - POSIX mandates this behavior.