PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] Escaped =
Date: Sunday, 27 Sep 2020, 08:59:38


    > Message Posted By: Unknown
    >
    > When any other special char is escaped, like \; , they are treated as
    > literals. However, equal signs are not. Is this behavior intentional? For
    > example:
    > (1)$ test\;test
    > CMD (Depth = 0):  SIMPLE,  argv[0] = test;test
    >
    > However,
    > (1)$ test\=test a j
    > CMD (Depth = 0):  SIMPLE,  argv[0] = a,  argv[1] = j
    >          LOCAL: test=test,
    >
    > Why is = being treated still as a command?

It is not.

As stated in the specification:

  Tokenization includes the following bash features:
   
  * [Escape Characters] The escape character \ removes any special meaning that
    is associated with the non-null, non-newline character immediately following.
    This may be used to include whitespace (but not newlines), metacharacters,
    and single/double quotes in a TEXT token.  The escape character is removed.

Thus test\;test is tokenized as test;test and test\=test
as test=test, both of which are TEXT tokens.  The first
must be an argument; the second must be a [local].

--Stan-
PREV INDEX NEXT