zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [doc] "sh_word_split nothing to do with word splitting"?
Date: Sun, 11 Mar 2018 20:53:48 +0000	[thread overview]
Message-ID: <20180311205348.GC6450@chaz.gmail.com> (raw)
In-Reply-To: <180311112407.ZM2303@torch.brasslantern.com>

2018-03-11 11:24:07 -0700, Bart Schaefer:
> On Mar 11,  9:44am, Stephane Chazelas wrote:
> } Subject: [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::.)
> 
> What this means to say:
> 
> This option applies to field splitting within an expanded shell word,
> not to splitting a command line into shell words during parsing.

Thanks Bart for confirming that.

What about changing it to something like:


diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 25b3d57..7677f73 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -2314,9 +2314,17 @@ pindex(NOSHWORDSPLIT)
 cindex(field splitting, sh style)
 cindex(sh, field splitting style)
 item(tt(SH_WORD_SPLIT) (tt(-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 noderef(Parameter Expansion).)
+Causes tt($IFS) field splitting to be performed on unquoted parameter
+expansions in addition to command substitutions. Note that contrary to
+POSIX shells, field splitting is still not performed on unquoted
+arithmetic expansions and contrary to the Bourne shell, not on words
+that are not the result of expansions. Like in other Bourne-like shells,
+field splitting is only performed in contexts where several words may be
+expected, such as in arguments to simple commands or anonymous functions,
+array assignments and for loop word lists. If the tt(MULTIOS) option is
+enabled, it is also performed in the targets of tt(<), tt(>) and tt(>>)
+redirection operators. (See noderef(Parameter Expansion) and
+noderef(Redirection)).
 )
 pindex(TRAPS_ASYNC)
 pindex(NO_TRAPS_ASYNC)

A reference to $IFS may also be useful. Is it possible to add
references to index entries in yodl?

(I only include the >, >>, < redirections, that's missing the
clobber variants and the >& >>&... Not sure how to express it
without making it too wordy).

Not sure it's worth mentioning:

$var() function-definition

as a context where shwordsplit happens.

See also https://unix.stackexchange.com/a/382914

-- 
Stephane


  reply	other threads:[~2018-03-11 20:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-11  9:44 Stephane Chazelas
2018-03-11 18:24 ` Bart Schaefer
2018-03-11 20:53   ` Stephane Chazelas [this message]
2018-03-11 23:41     ` Martijn Dekker
2018-03-12  7:43       ` Stephane Chazelas
2018-03-12  8:07         ` Stephane Chazelas
2018-03-16 17:26           ` Stephane Chazelas
2018-03-16 18:28             ` Bart Schaefer
2018-03-16 19:33               ` Stephane Chazelas
2018-03-24 20:17         ` Martijn Dekker
2018-03-25  6:42           ` Stephane Chazelas
2018-03-26 18:11             ` Martijn Dekker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180311205348.GC6450@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).