bug-bash
[Top][All Lists]
Advanced

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

Re: bash2 can't parse function definitions inside if statements


From: Chet Ramey
Subject: Re: bash2 can't parse function definitions inside if statements
Date: Mon, 13 Nov 2000 10:43:21 -0500

> Machine Type: i386-redhat-linux-gnu
> 
> Bash Version: 2.03
> Patch Level: 8
> Release Status: release
> 
> Description:
>       bash2 doen't seem to be able to parse if statements that contain
>       function definitions. Note that plain old bash doesn't have this
>       problem. Here's a test script to demonstrate:
> 
> =========================== C U T   H E R E ===========================
> # Test script for functions in ifs in bash2
> # bash can execute this script just fine, but bash2 cannot :-(

That's because the script has a syntax error that bash-1.14.x accepted
inappropriately.

> then
>     function greet () { echo hello "$*" }
>     echo Howdy
> else
>     function greet () { echo goodbye "$*" }
>     echo Ack!
> fi

A semicolon is required before the closing brace.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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