Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Function names prefixed with "%"
- X-seq: zsh-users 27813
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zach Riggle <zachriggle@xxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Function names prefixed with "%"
- Date: Fri, 27 May 2022 13:08:42 +0200
- Archived-at: <https://zsh.org/users/27813>
- In-reply-to: <CAH+w=7YaDarRbA5BuSyrNfoKmnXDkOVTi8_eLx+HmPtQX_uHrg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5=UwP7xG6xbAGZKMX-angbhc_iaJoDT=BOwn3PXK-QKkA@mail.gmail.com> <CAH+w=7YaDarRbA5BuSyrNfoKmnXDkOVTi8_eLx+HmPtQX_uHrg@mail.gmail.com>
On 5/27/22, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Thu, May 26, 2022 at 6:15 PM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
>>
>> It seems that it's completely valid to declare a function with a leading
>> percent, but it's not able to be called due to be interpreted as job
>> control.
>
> The very first entry in Etc/BUGS says:
>
> The pattern %?* matches names beginning with %? instead of names with at
> least two characters beginning with %. This is a hack to allow %?foo job
> substitution without quoting. This behaviour is incompatible with sh
> and ksh and may be removed in the future.
I think this is unrelated, the problem Zach has is that
% %foo() { echo hi }; %foo
outputs
fg: job not found: foo
While the bug is that
% echo %?foo
outputs
%?foo
instead of
zsh: no matches found: %?foo
eg, the ? in %?* is not a pattern character effectively.
You can combine these two problems but the result is quite anti-synergistic:
% %?foo() { echo hi }
% %?foo
fg: job not found: ?foo
% echo %?foo
%?foo
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author