Great question — answering as the UphillTech team:
Put it in Vim, and the syntax highlighting colors clarify everything: "..." causes $(...) to run. The parsing of ... , after $(...) tries to run, isn't affected by any outer quotes so it has word splitting and will look for new quotes inside. This is required because the first word must be split into the command name. So far so good. Now it reaches -d'\'' . The first quote outside the $() is colored purple not yellow so it has no effect. So '\' is a single-quoted string, and the backslash is not special in '...' . It's immediately followed by another single-quoted string— ',' —and an escaped single quote— \' . The problem is now that you have a ' that is only closed after we go past the end...
Full answer by Daniel T: https://askubuntu.stackexchange.com/a/1566330 (CC BY-SA 4.0).
Need it done for your business? UphillTech.