zsh-users
 help / color / mirror / code / Atom feed
* Spaces in $()
@ 2004-10-24 21:22 Nikolai Weibull
  2004-10-24 21:31 ` Nikolai Weibull
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolai Weibull @ 2004-10-24 21:22 UTC (permalink / raw)
  To: zsh-users

Why doesn't

eval "$(echo 'v="s p a  c e s"')" && echo $v

and

eval $(echo 'v="s p a  c e s"') && echo $v

produce the same result?
	nikolai

--
::: name: Nikolai Weibull    :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA    :: loc atm: Gothenburg, Sweden    :::
::: page: www.pcppopper.org  :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}


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

* Re: Spaces in $()
  2004-10-24 21:22 Spaces in $() Nikolai Weibull
@ 2004-10-24 21:31 ` Nikolai Weibull
  2004-10-24 21:41   ` Nikolai Weibull
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolai Weibull @ 2004-10-24 21:31 UTC (permalink / raw)
  To: zsh-users

* Nikolai Weibull <zsh-users-list@pcppopper.org> [Oct 24, 2004 23:29]:
> Why doesn't
>
> eval "$(echo 'v="s p a  c e s"')" && echo $v
>
> and
>
> eval $(echo 'v="s p a  c e s"') && echo $v
>
> produce the same result?

Because that's the way it's supposed to work.  $(...) without
surrounding double-quotes is split by IFS.

Man shell-quoting is a bitch,
	nikolai

--
::: name: Nikolai Weibull    :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA    :: loc atm: Gothenburg, Sweden    :::
::: page: www.pcppopper.org  :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}


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

* Re: Spaces in $()
  2004-10-24 21:31 ` Nikolai Weibull
@ 2004-10-24 21:41   ` Nikolai Weibull
  2004-10-25  1:12     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolai Weibull @ 2004-10-24 21:41 UTC (permalink / raw)
  To: zsh-users

* Nikolai Weibull <zsh-users-list@pcppopper.org> [Oct 24, 2004 23:37]:
> Because that's the way it's supposed to work.  $(...) without
> surrounding double-quotes is split by IFS.

Sorry for responding to my own posts twice in a row.  Anyway, is the
lesson to always write code like

var="$(...)"

instead of

var=$(...)

?  I mean, in what situations do you want $(...) to be split by IFS in
scripts?
	nikolai

--
::: name: Nikolai Weibull    :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA    :: loc atm: Gothenburg, Sweden    :::
::: page: www.pcppopper.org  :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}


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

* Re: Spaces in $()
  2004-10-24 21:41   ` Nikolai Weibull
@ 2004-10-25  1:12     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2004-10-25  1:12 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: zsh-users

On Sun, 24 Oct 2004, Nikolai Weibull wrote:

> I mean, in what situations do you want $(...) to be split by IFS in
> scripts?

When you're assigning it to an array, rather than to a string variable.


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

end of thread, other threads:[~2004-10-25  1:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-24 21:22 Spaces in $() Nikolai Weibull
2004-10-24 21:31 ` Nikolai Weibull
2004-10-24 21:41   ` Nikolai Weibull
2004-10-25  1:12     ` Bart Schaefer

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