bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Having an alias and a function with the same name leads to some sort


From: alex xmb ratchev
Subject: Re: Having an alias and a function with the same name leads to some sort of recursion
Date: Thu, 16 Feb 2023 16:40:34 +0100

On Thu, Feb 16, 2023, 4:14 PM Chet Ramey <chet.ramey@case.edu> wrote:

> On 2/14/23 2:58 PM, Dale R. Worley wrote:
> >>> Looking at the manual page, it says
> >>>
> >>>      ALIASES
> >>>         Aliases  allow a string to be substituted for a word when it
> is used as
> >>>         the first word of a simple command.
> >
> > Martin suggested (but IIUC didn't sent to this list):
> >> "Beginning of a simple command" should probably be replaced by something
> >> more along the lines of "beginning of any command that does not start
> with
> >> a keyword (such as "while", "if", "case", etc) or assignment.
> >
> > Though I think by "keyword" he means "reserved word".
>
> I think the issue is that he's applying a grammar interpretation (simple
> command) to something that is a completely lexical operation. Alias
> expansion happens in the lexical analyzer, and it happens when a token
> can potentially be the first word of a simple command.
>
>
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03_01
> tries to make that clear:
>
> "After a token has been delimited, but before applying the grammatical
> rules in Shell Grammar, a resulting word that is identified to be the
> command name word of a simple command shall be examined to determine
> whether it is an unquoted, valid alias name."
>

step 1 textual expansion ( minimal effort alias resolvement )
step 2 the normal cmd shelling

u know , me no native english , and this and that words , .. cant
understand much ..

geeets

You can put any syntax element into an alias and the shell will parse it.
> The only POSIX restriction is that you can't alias reserved words.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]