Right, the programs don't see those empty strings because the shell is
stripping them when it parses the line. But for options, for the shell
parser to strip away the empty string presumes that the user made a mistake
and has needlessly/erroneously provided a useless empty string.

In the case for read -d'' very probably the user has attempted to supply
the null delimiter, but read quietly takes the next argument. I think it
makes sense to bump empty strings away from the option when they occur
after options in the Bash interpreter parsing of the commandline.
-d''  --> -d ''

On Tue, Jan 19, 2016 at 11:49 AM, Greg Wooledge <wool...@eeg.ccf.org> wrote:

> On Tue, Jan 19, 2016 at 11:39:07AM -0500, Adam Danischewski wrote:
> > Bash also removes the single quotes before it hits read when the single
> > quotes are attached to the delimiter option (-d'').
>
> And in EVERY OTHER COMMAND.  This is how quotes work.  This is utterly
> fundamental to bash and the entire Bourne shell syntax.
>
>   echo ""'a'''$''""''
>
> Is *exactly* the same as
>
>   echo a
>
> Echo has no way to know that you typed a and not "a" or a"" or 'a' or ....
>

Reply via email to