[-- Attachment #1: Type: text/plain, Size: 716 bytes --] Hello, var='!hello world'; setopt shwordsplit; [[ ${${var}[1]} != '!' ]] && print No exclamation mark detected Output: No exclamation mark detected local -A hsh=( key '!hello world' ); setopt shwordsplit; [[ ${${hsh[key]}[1]} != '!' ]] && print No exclamation mark detected Output: No exclamation mark detected local -a arr=( '!hello world' ); setopt shwordsplit; [[ ${${arr[1]}[1]} != '!' ]] && print No exclamation mark detected Output: No exclamation mark detected Question: doesn't using [[ mean that the arguments are quoted -> shwordsplit is inactive? -- Sebastian Gniazdowski News: https://twitter.com/ZdharmaI IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin Blog: http://zdharma.org
On Tue, 2019-11-05 at 13:22 +0100, Sebastian Gniazdowski wrote:
> Question: doesn't using [[ mean that the arguments are quoted ->
> shwordsplit is inactive?
Only quotes mean that arguments are quoted.
The complication is that there is a context where we don't split the
argument because we know a single word is needed. That's not the same
as forcing quoted semantics, however. Use explicit quotes for that.
pws