Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is quoting of the assigned value needed?
- X-seq: zsh-users 24456
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: <zsh-users@xxxxxxx>
- Subject: Re: Is quoting of the assigned value needed?
- Date: Fri, 22 Nov 2019 10:45:08 +0000
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191122104510euoutp02e50c949f41b027b55213376d9b957531~ZdjP6dsc12485424854euoutp02V
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1574419510; bh=+vQM3iEEgWsrkXVMCTdc79Jcr3RxGsJKhutdSVNB7hs=; h=Subject:From:To:Date:In-Reply-To:References:From; b=bT3aeS4l5Dyz90msaQAr3DlXoDYTZZ02IcRPPhoTuj7NbnpDrJkkvsuUGhkPmstHm fkoIwyVCkDc1ckDrty9JH/XVd+cBLKTeKjwslh47UC+cMfd5PZaTNZbloMkgCKOyEE yOqIXAuwxdOw6BbulY2SVZu/JTVR9e5CizRLsdpI=
- In-reply-to: <CAKc7PVAUqWfNvvJi+k7A9qW7g9w3GqaUTXTML0yWo9fHGUuwbA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20191122020437eucas1p128174332018d20a266f55007fcf271ba@eucas1p1.samsung.com> <CAKc7PVAUqWfNvvJi+k7A9qW7g9w3GqaUTXTML0yWo9fHGUuwbA@mail.gmail.com>
On Fri, 2019-11-22 at 03:03 +0100, Sebastian Gniazdowski wrote:
> Hello,
> SH_WORD_SPLIT doesn't seem to cause any effects in this context:
>
> setopt SH_WORD_SPLIT
> var1="a b"
> var2=$var1
> print "$var2"
>
> Output: a b
Correct, there's no splitting there: you've got a quoted assignment, a
single word assignment, and quoted output.
What you should be doing depends on what you're trying to do, which you
don't say. Do you want var2 to be an array of split parts of $var1? In
that case, do an array assignment.
var2=($var1)
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author