Pierre Gaston wrote:

Just quote the spaces and not the special chars:

Pierre, your suggestion doesn't help clean up strings used inside of double
brackets.  I wanted to avoid the need for multiple backslashes in an expression 
as it makes the expression less readable and more error prone.

Note that the same problem and solution exist when you use filename generation:

for f in /some path/ withspaces/*; do  # doesn't work the path contains spaces
----
        I'm aware of that, but since [[ and ]] are new, and =~ is new, there
is no legal interpretation for multiple arguments on either side of the =~
operator.

Since =~ permits comparing variables _without_ putting quotes around them,
(as would normally be the case if you used the single square brackets and
plain '='), why not extend that idea to not needing quotes between
the =~ and either side of the double square brackets so literal strings benefit from not needing quotes as well.

Of course, if quotes *are* included on the rhs, then the pattern matching
(glob or regex) would be disabled as happens now.

Is there a downside to this syntax or this idea?


Reply via email to