Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zsh function declaration bug
- X-seq: zsh-workers 44026
- From: Mitchell Gildenberg <mgild@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: zsh function declaration bug
- Date: Wed, 30 Jan 2019 09:46:02 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=o4p2vt6FwCSMJ2CCAJ8McdGb481tOH0Bi4FWZNeKE2g=; b=qBkwvsqL1qwM9q/FcVlVBkEakAKMl1BJAv3tc6TsRWYGoEbQ+PPiySHM1hzYelkHZL +g4Hy1+uXPZjGEnVG8aEHtFsm58+nmwR2rjCjsSWbUQ19jZCgmcpZqfCY4TO5W1qFGpn ztGhklDRNrfMoTy3apP9HrDW/d/bHxLpC26GuJpbOn1SJkQ4Ck0eD9iivsyyxxmPu1Zg 4HP/JM0pmodq98reRQnHpSFHo+FMPchRGtsTKTPL5+iVabExU/w2tTDuLWpnnHUtqdFh l3C6fkwDnwuGx8dukNX3sNxIFzGU1sPaVlnsS2Jhx+/H3P8oE/YQQyEuQjHl9iKxKVlb zqSQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hello,
I noticed some interesting behavior when declaring zsh functions without
specifying the `function` keyword. When I declare a function that is a
prefix of some other item in my path or another alias, the function that is
a prefix is called instead. For example:
------------
(macbook) ➜ mgild $ zsh --version
zsh 5.3 (x86_64-apple-darwin17.0)
(macbook) ➜ mgild $ ls
Applications/ Desktop/ Documents/ Downloads/ Library/
Movies/ Music/ Pictures/ Public/
(macbook) ➜ mgild $ l(){echo "hello"}
(macbook) ➜ mgild $ ls
hello
(macbook) ➜ mgild $
-------------- (zsh 5.5 exhibits different behavior)
➜ mgild $ zsh --version
zsh 5.5 (x86_64-debian-linux-gnu)
➜ mgild $ ls
Desktop Documents
➜ mgild $ l(){ echo "hello"}
zsh: defining function based on alias `ls'
zsh: parse error near `()'
--------------
zsh 5.5 seems to exhibit different behavior, but it is still unexpectedly
failing to create the function.
Let me know if any more information is required.
Thank you.
Mitchell Gildenberg
mgild@xxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author