From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15260 invoked by alias); 19 Dec 2014 03:27:46 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19582 Received: (qmail 7571 invoked from network); 19 Dec 2014 03:27:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:content-type:mime-version :subject:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to; s=smtpout; bh=Jo5e62TqgpeN9rXy8a9PiCI Pul4=; b=bNs1edkpYQHyWj6sclPVOmqU6o7dF7PuHgOYQijx5f60PFWRokyEjwY hOJccUq5Q4fnKrgAZxZLEpnFgRfZk9L8BzRLv8ZVC+ViQzZb/s+922i0nzKgQaVi yrAi2uYGQzCtOIJZvJfyUf3OHbjdQO1ggThHOZ0/G6b7ovoRExmI= X-Sasl-enc: t3KZRalQ01CCfYR3FoArlQE9m5MqdzFWe7Gc5OF/QX97 1418959211 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: surprise with echo From: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= In-Reply-To: <141218190653.ZM16331@torch.brasslantern.com> Date: Thu, 18 Dec 2014 22:20:10 -0500 Cc: zsh-users@zsh.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <54937E5B.2020008@eastlink.ca> <141218190653.ZM16331@torch.brasslantern.com> To: Ray Andrews X-Mailer: Apple Mail (2.1993) On Dec 18, 2014, at 10:06 PM, Bart Schaefer = wrote: > On Dec 18, 5:24pm, Ray Andrews wrote: >=20 > } Can that be prevented? >=20 > Only by turning off the option, or by doing e.g. ${@:-''} so that the > expansion is the empty string rather than the empty array. Also note that "preventing" it would amount to treating an empty array the same as an array containing a single null value, which is currently not the case: % emulate zsh && setopt RC_EXPAND_PARAM % foo=3D() % echo "abc${foo[*]}def" abcdef % echo "abc${foo[@]}def" % foo=3D('') % echo "abc${foo[*]}def" abcdef % echo "abc${foo[@]}def" abcdef You're making quite a few assumptions about how positional parameters and array substitution work. For instance, the fact that you're using double quotes (which affects the expansion of $foo[*] versus $foo[@]) is clouding your understanding of how RC_EXPAND_PARAM works. Observe: % emulate zsh && setopt RC_EXPAND_PARAM % foo=3D() % echo "abc${foo[*]}def" abcdef % echo abc${foo[*]}def % Please read zshparam(1). vq=