help-bash
[Top][All Lists]
Advanced

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

Parsing, metacharacters, tokens.


From: Cristian Zoicas
Subject: Parsing, metacharacters, tokens.
Date: Thu, 19 May 2022 12:32:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.3

Hello all,

There are situations when it is not clear from the manual how bash
performs expansions/splitting/substitutions.

According to what is written in the manual a metacharacter is:

    A character that, when unquoted, separates words. A metacharacter
    is one of the following characters:
        <space> <tab> <newline> | & ; ( ) < >

Now let's assume the following statement:

A=START$(echo _)END

According to the definition of metacharacters the first token would be
"A=START$" (because '(' separates tokens) and then will follow the rest of
the tokens .

I may be wrong, but I my intuition tells me that bash does something like
this: The only token found on that line is the entire line itself. If this
is true, then '(' does not behave like a metacharacter because it does not
separate words due to that fact that it is preceded by a $. So there seems
to be some kind of entity in bash that is a metasequence ('$(' in this
case) which is interpreted as a metasequence only when the value of A is
computed but it is not considered a metasequence when the line is read.

Can you explain what is going on?

Best regards
Cristian




reply via email to

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