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

Re: weird behaviour of quotes in dash variable assignments



On 2020-09-20 20:38, David wrote:

From the perspective of not knowing how these bash scripts were deployed,
it's worth confirming that what we are assuming is the "same bash script" are
indeed exactly identical.

$ cmp script1 script2

If somehow the double quotes in the problem script have become something
other than plain ASCII 0x22 bytes, that could explain the observed behaviour.
Because extended character sets can contain a variety of characters that
visually appear identical to their plain ASCII counterparts. But the shell won't
parse and remove them as quote characters, even though they "look like" quote
characters.

A spurious space character at the end of the line is invisible in most editors, but can cause problems for some programs. For other programs, spaces at the end of a line have meaning (e.g. Markdown). Similarly, leading or interior spaces vs. tab will drive you mad (e.g. Make). Without the files and the servers they run on, we can only speculate.


David


Reply to: