From: Peter Stephenson <firstname.lastname@example.org> To: email@example.com Subject: Re: Bug in function in function Date: Fri, 20 May 2022 18:46:35 +0100 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <YofO/r45jWmIix2u@ikki.ethgen.ch> On Fri, 2022-05-20 at 18:25 +0100, Klaus Ethgen wrote: > Am Fr den 20. Mai 2022 um 18:16 schrieb Mikael Magnusson: > > On 5/20/22, Klaus Ethgen <Klaus@ethgen.ch> wrote: > > > I have an alias `alias ls="LC_COLLATE=POSIX ls $_ls_opts"` before this > > > line but that should not interfere the function definition. > > > > In fact it should, and it does. Change your function definition(s) to > > the form "function ls". > > Putting a `function` in front of `ls()` work. > > However, I was thinking, `function` (in that context) is deprecated. No, it's valid syntax and will remain so --- just avoid using both function in front AND () afterwards. This is indeed the recommended fix for this case. The point, in case it isn't already obvious, is that alias expands everything in command position before it's even been parsed --- so your "ls" has turned into something else on input before the shell has even swallowed the (). With the function keyword, the following word is no longer in command position. pws
next prev parent reply other threads:[~2022-05-20 17:46 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-19 19:34 Klaus Ethgen 2022-05-20 15:37 ` Bart Schaefer 2022-05-20 17:12 ` Klaus Ethgen 2022-05-20 17:16 ` Mikael Magnusson 2022-05-20 17:25 ` Klaus Ethgen 2022-05-20 17:46 ` Peter Stephenson [this message] 2022-05-20 17:47 ` Bart Schaefer 2022-05-20 18:14 ` Klaus Ethgen 2022-05-20 18:36 ` Peter Stephenson
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 \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: Bug in function in function' \ /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
Code repositories for project(s) associated with this 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).