On Tue, Jun 23, 2020 at 12:33:23PM -0700, L A Walsh wrote: > It's a gmail feature to mangle your input in weird ways when you cut/paste. > the line with 'output=""' is separate from the "printf" line. Sorry.
First, stop top-quoting. Second, if you know that gmail is horrible and is going to mangle your input, stop using it. Third, if you actually want to debug the issue, you will get a MUCH better view of the variable's contents if you hex-dump it, instead of just throwing some random punctuation around it and praying that what you see on the terminal is all that's in the variable. printf %s "$output" | od -tx1 -An or something similar. Since you mentioned Cygwin, and since you mentioned gmail, one can guess that Microsoft Windows is invovled in this picture, which means that carriage returns are likely to be involved in this picture, which can mess up a script in a multitude of ways. Hex-dumping the variable's contents would be a reasonably sure way to tell whether there are carriage returns, non-breaking spaces, or other abominations in the variable. If it turns out that the variable actually *is* clean, and you've legitimately found some sort of bug that only happens in the Cygwin environment, well, congratulations. I guess. Not that many people on this list have access to that environment for confirmation purposes.