From: Matthew Martin <phy1729@gmail.com>
To: "Ngô Huy" <huynhok.uit@vnoss.org>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: [Zsh bug] function define bug
Date: Tue, 24 Nov 2015 22:06:26 -0600 [thread overview]
Message-ID: <CAGnh9tB8oEua8npLmkhbPPBvMq1C3wfusnTo0MzLx0RjAiGaHw@mail.gmail.com> (raw)
In-Reply-To: <CAPO9ZdrRL9e+B4urS4S5EitsOqjQYYji6F13JWkmOwLA=FyEbw@mail.gmail.com>
On Tue, Nov 24, 2015 at 9:46 PM, Ngô Huy <huynhok.uit@vnoss.org> 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 `()'
next prev parent reply other threads:[~2015-11-25 4:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-25 3:46 Ngô Huy
2015-11-25 4:06 ` Matthew Martin [this message]
2015-11-25 4:20 ` Ngô Huy
2015-11-25 8:49 ` Cuong Manh Le
2015-11-25 9:03 ` Ngô Huy
2015-11-25 9:04 ` Ngô Huy
2015-11-25 9:16 ` Christoph (Stucki) von Stuckrad
2015-11-25 9:20 ` Cuong Manh Le
2015-11-25 9:39 ` Ngô Huy
2015-11-25 9:58 ` Cuong Manh Le
2015-11-25 10:00 ` Peter Stephenson
2015-11-25 10:13 ` Ngô Huy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGnh9tB8oEua8npLmkhbPPBvMq1C3wfusnTo0MzLx0RjAiGaHw@mail.gmail.com \
--to=phy1729@gmail.com \
--cc=huynhok.uit@vnoss.org \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).