Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[doc] "sh_word_split nothing to do with word splitting"?



SH_WORD_SPLIT (-y) <K> <S>
     Causes field splitting to be performed on unquoted parameter
     expansions.  Note that this option has nothing to do with word
     splitting.  (See *note Parameter Expansion::.)

[...]

${=SPEC}
     Perform word splitting using the rules for SH_WORD_SPLIT during the
     evaluation of SPEC, but regardless of whether the parameter appears
     in double quotes; if the '=' is doubled, turn it off.  This forces
     parameter expansions to be split into separate words before
     substitution, using IFS as a delimiter.  This is done by default in
     most other shells.

     Note that splitting is applied to WORD in the assignment forms of
     SPEC _before_ the assignment to NAME is performed.  This affects
     the result of array assignments with the A flag.

It's unclear to me what is meant by "Note that this option has
nothing to do with word splitting" here.

It seems the  SH_WORD_SPLIT description makes a distinction
between "field splitting" and "word splitting", but then again
throughout the manual (including the $=spec description above),
"word splitting" and "field splitting" are used interchangeably
to refer to the same thing.

Was the intended meaning something like: "Note that it does not
affect how the shell delimits tokens" or something like that?

From:
https://unix.stackexchange.com/questions/26661/what-is-word-splitting-why-is-it-important-in-shell-programming

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author