Open earthbound19 opened 6 years ago
For the umpteenth time I've discovered that sed / gsed (EDIT: but what about the cygwin version?) on windows inserts #@$! windows newlines, and that any stream-created variables with that must append this--as it says in this issue:
| tr -d '\15\32'
(removes windows newline)
python strings passed via argsparse are mucky on windows. solved with stringVariable.rstrip()
re a genius breath yonder
Investigate whether msys2 tools don't cause CRLF (control linefeed / windows newline) problems?
OR per updated issue note (first sentence).
the sed.exe
that ships with MSYS2 does not cause this issue. It's 100% an issue with Cygwin's sed.exe
. Witnessed in fixing a bug manifest on Windows in hexplt2ppm.sh
(it produced wrong colors via Gygwin sed.exe
(hax renamed to gsed.exe
by me), and did not produce the issue with MSYS2 sed.exe
(hax renamed to gsed.exe
by me).
Dumping Cygwin sed. DELETE the blankety-blank file after install unless/until migration to MSYS2 toolchain.
Updated OP with checklist and progress of checklist.
But this may be a more efficient way to remove windows newlines if you must; test before using:
re: https://stackoverflow.com/a/19347380/1397555
variable=${variable//[$'\t\r\n']}
^ THAT!
UPDATE: stop using any gnu utilities ports that create windows newlines (such as those that come with cygwin), and use only ones that don't (such as from MSYS2).
items in this problem:
find . -name '*.svg' | sed 's|^./||' > all_svgs.txt
. Do instead something like:array=( $(find . -maxdepth 1 -type f -iname \*.png -printf '%f\n') )
gsed "$sedCommand" numberedCopies.txt | tr -d '\15\32'
~ Uh, better yet, pipe to tr -d .. when the text file is created.Case with find vs. gfind: https://serverfault.com/a/354407/121188