On 1/17/19 1:53 AM, kevin wrote: > > Since *[[* isn't a normal command (like [ is), but a /shell > keyword/, *it has special magical powers*. *It parses its arguments > before they are expanded by Bash and does the expansion itself*, > taking the result as a single argument, even if that result contains > whitespace. (In other words, [[ does not allow word-splitting of its > arguments.) /However/, be aware that simple strings still have to be > quoted properly. [[ treats a space outside of quotes as an argument > separator, just like Bash normally would. > > Unfortunately, there is no example that shows how *[[* differs from the > usual shell operation. I know that the documentation does not indicate the > particular property of "[[" (features)
Sure it does. The expansions and parsing are covered in the man page description of `[['. For instance: "Word splitting and pathname expansion are not performed on the words between the [[ and ]]; tilde expansion, parameter and variable expansion, arithmetic expansion, command substitution, process substitution, and quote removal are performed." The parsing and expansions that `[[' performs are specified completely. They are different from the set of word expansions a simple command like `[' undergoes before it is executed. , and there has been an adjustment > based on the operator "==" concerning "=~" but I still do not understand > why we could not have used the normal shell rules. In your example, a user > may use single quotes to escape the special meaning of the $ sign "abc'$'". What are those "normal shell rules?" And how would you have applied them to specify something that was unspecified before? This discussion began in mid-2006, maybe go back and look at the bug-bash archives to see what people were reporting? Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/