zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug with bash emulation regarding ':'
@ 2012-02-10 11:08 Jilles Tjoelker
  0 siblings, 0 replies; 29+ messages in thread
From: Jilles Tjoelker @ 2012-02-10 11:08 UTC (permalink / raw)
  To: Zsh Hackers' List, Peter Stephenson

> [zsh performs word splitting on ${...:=$(...)}]

It seems strange to perform word splitting on word in ${var=word}
because a single word is required to assign to var. Indeed, zsh pastes
the resulting words back together to a single word to assign.

Historically, there have been two ways to perform word splitting here:
either by expanding the construct as ${var-word} or by expanding $var
after assignment. POSIX requires the latter. This implies that quoting
characters inside word does not prevent word splitting and pathname
generation. (Quoting the entire expansion does.)

In either case, if assignment takes place, the assigned value is the
expanded value of word with quote removal performed on it. (POSIX lacked
the detail of quote removal, formally requiring the assigned value to
retain the quoting characters; an interpretation has been issued.)

-- 
Jilles Tjoelker


^ permalink raw reply	[flat|nested] 29+ messages in thread
* Bug with bash emulation regarding ':'
@ 2012-01-29  2:46 Felipe Contreras
  2012-01-29  5:31 ` Benjamin R. Haskell
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Felipe Contreras @ 2012-01-29  2:46 UTC (permalink / raw)
  To: zsh-workers

Hi,

Seems like there's a bug in bash emulation:

---
#!sh

_test ()
{
	array="one two three"
	for e in $array
	do
		echo "'$e'"
	done
}

l=
: ${l:=$(_test)}
echo "_${l}_"
---

Bash generates:

_'one'
'two'
'three'_

Zsh with bash emulation generates:

_'one two three'_

-- 
Felipe Contreras


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2012-02-20 17:10 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-10 11:08 Bug with bash emulation regarding ':' Jilles Tjoelker
  -- strict thread matches above, loose matches on Subject: below --
2012-01-29  2:46 Felipe Contreras
2012-01-29  5:31 ` Benjamin R. Haskell
2012-01-29 13:44   ` Felipe Contreras
2012-01-29 14:25     ` Mikael Magnusson
2012-01-29 14:27       ` Mikael Magnusson
2012-01-29 18:38       ` Vincent Lefevre
2012-01-29 18:53         ` Mikael Magnusson
2012-01-29 19:01           ` Vincent Lefevre
2012-01-29 20:30             ` Peter Stephenson
2012-01-29 21:05               ` Mikael Magnusson
2012-01-30 22:15       ` Felipe Contreras
2012-01-30 22:18         ` Mikael Magnusson
2012-01-29 18:36 ` Peter Stephenson
2012-02-01  4:29   ` Bart Schaefer
2012-02-01 16:29     ` Bart Schaefer
2012-02-05 20:11       ` Peter Stephenson
2012-02-05 21:21         ` Bart Schaefer
2012-02-10 21:04           ` Peter Stephenson
2012-02-11 21:08             ` Bart Schaefer
2012-02-12 20:29               ` Peter Stephenson
2012-02-14 17:41         ` Peter Stephenson
2012-02-14 23:30           ` Chet Ramey
2012-02-15 12:36             ` Peter Stephenson
2012-02-19 23:45               ` Bart Schaefer
2012-02-20  8:48                 ` Bart Schaefer
2012-02-20 10:59                 ` Peter Stephenson
2012-02-20 17:09                   ` Bart Schaefer
2012-01-30 19:22 ` Felipe Contreras

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).