Author: Stan Eisenstat
Subject: Correction: An amusing test case
Date: Monday, 19 Oct 2020, 11:42:14
Yesterday I posted an important example:
Here is an example of why you cannot always replace all
occurrences:
$ echo \$1\$A\$1 | A=\$1 ./mcBash \$A
(1)$ >> $A$1$A
The input is "$1$A$1\n". If you replace all occurrences
of "$A" by its value "$1", giving "$1$1$1\n" and then
replace all occurrences of "$1" by its value "$A", you
get "$A$A$A\n", which is incorrect. If you replace all
occurrences of "$A" by its value "$1", giving "$1$1$1\n"
and then replace all occurrences of "$1" by its value "$A",
you get "$A$A$A\n", which is still incorrect.
The last sentence should have been:
... If you replace all
occurrences of "$1" by its value "$A", giving "$A$A$A\n"
and then replace all occurrences of "$A" by its value "$1",
you get "$1$1$1\n", which is still incorrect.
--Stan-
PREV
INDEX
NEXT