this is a special interpretation added by the shell, and programs don't actually see the ''s. If you put a '' next to other non-whitespace characters, it disappears in the command line that the program will see.
I object to the notion that this is a special interpretation. The author is just misunderstanding the general case of how shells parse commands.In most shells, you can concatenate strings by placing them directly next to one another. Ie, this forms one string containing the word foobarbaz: foo"bar"'baz'
This is useful because different types of quotation marks have different semantics. Eg, double quotes are interpolating while single quotes are not. You might want to mix interpolated portions and non-interpolated portions into a single argument or assignment.Shell is also famously stringly-typed. All parameters passed to a command (and indeed, even the command itself) are separate strings. So indeed, the final find command from this blog post could also be written as: "read" "-r" "-d"'' "line"
Then the error becomes clear.This is an important thing to understand if you're going to write any non-trivial amount of shell, especially if you're using a shell variant that opportunistically wordsplits (like POSIX sh or Bash, as opposed to Zsh). As an aside, this is also an example of why it's good to keep a consistent and clean style, and not unnecessarily shorten in every circumstance where you could get away with it. Mashing command line parameters together makes them a lot less readable, and is meant more as a convenience for interactive usage, than for writing scripts meant to be read and expanded upon later. |