2022-10-31 12:00:24 -0700, Scott Lurndal via austin-group-l at The Open Group:
[...]
> However, another benefit of the '[[' builtin is that it does not
> do word splitting or pattern expansion.
[...]

"[" doesn't do word splitting of pathname expansion either, it's
the shell that does if you forget to quote.

For [[...]] not to do that, it needs to introduce a new language
different from the usual shell one.

Should we then introduce a:

[ls -ld $file] construct, so we can leave $file unquoted and
omit the -- there as well to list information from a file so we
don't have to write ls -ld -- "$file"?

And maybe a [echo foo\n$var], with again its own language to
remove that old problem where echo "$var" fails for values of
$var that start with - (with some implementations) or does
unwanted escape expansions on the contents of $var.

Note that though no word splitting is done inside [[...]]
(except of course inside command substitutions within), it still
does pattern matching.

[[ $a = $b ]] still needs to be written [[ "$a" = "$b" ]] or at
least [[ $a = "$b" ]] if you want to do byte-to-byte comparison.

-- 
Stephane

  • [1003.1(2008... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • Re: [10... Scott Lurndal via austin-group-l at The Open Group
      • Re:... Roger Marquis via austin-group-l at The Open Group
        • ... Tapani Tarvainen via austin-group-l at The Open Group
        • ... Scott Lurndal via austin-group-l at The Open Group
          • ... Stephane Chazelas via austin-group-l at The Open Group
      • Re:... Stephane Chazelas via austin-group-l at The Open Group
      • Re:... Robert Elz via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to