Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [Zsh bug] function define bug
- X-seq: zsh-users 20982
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: Ngô Huy <huynhok.uit@xxxxxxxxx>
- Subject: Re: [Zsh bug] function define bug
- Date: Tue, 24 Nov 2015 22:06:26 -0600
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Ag2XTQkWnGNqMvl7xgBGHiQAzFMefEDZZRxhnmc4Txk=; b=DqyG3TjQA9BD77gnzRmVk7WgLK5HAG2afwtAkSNPC99QcT3nmp/d0MBN1SVvE3X79x +RicPmF3tBHleXWdpsSTOC90bxHBamYVgxU56bhKm4Q0bE0m3NnOOpwDo9iQ9yB564o9 EDnbIdijG1Nbhty7T4y2Ty4DIbcYzjYUUmnPwnQBaCC63SO71l1ZlHjqB/QhJ3ZVTArx T2wmfO1U5ExId/owMERXVswrzRrudsVcc0KjnXxFdzPLX4/K3+zuGST3qxHPxNxS9qZS Yj5cXoKqPlISUSDz+NxvsbQ9MgbELShzfMD/0+a5/c+YH5xWWW1mmryZHFhLo0h/QV+x gbRg==
- In-reply-to: <CAPO9ZdrRL9e+B4urS4S5EitsOqjQYYji6F13JWkmOwLA=FyEbw@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAPO9ZdrRL9e+B4urS4S5EitsOqjQYYji6F13JWkmOwLA=FyEbw@mail.gmail.com>
On Tue, Nov 24, 2015 at 9:46 PM, Ngô Huy <huynhok.uit@xxxxxxxxx> wrote:
> Dear folks,
>
> I found the problem in zsh define function. Demo
>
> ls test() { echo "Bug !!!"} && ls && test
>
> it will print
>
> Bug !!!
> Bug !!!
That's expected behaviour. Since MULTI_FUNC_DEF is set by default in zsh
mode, both ls and test are being defined as functions with the body
echo "Bug !!!".
% func1 func2 () { echo This is "$0"; }
% func1; func2
This is func1
This is func2
% which func{1,2}
func1 () {
echo This is "$0"
}
func2 () {
echo This is "$0"
}
% unsetopt MULTI_FUNC_DEF
% func1 func2 () { echo This is "$0"; }
zsh: parse error near `()'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author