Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: <(<<<x) vs =(<<<x)
- X-seq: zsh-workers 30931
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: <(<<<x) vs =(<<<x)
- Date: Fri, 21 Dec 2012 15:51:14 +0000
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=adJu83uP2uD5bNPLeftSMrBccnXkBYRS+/fWVPNGoJ4=; b=Noo9qHSW5+kSUicms6vWgTHS4uHSCWP86+4hTidOTOKgtX9O3Llu2nc0Bcl/y7s5Te ODJLANGQ/4LYa1ckxu6iuEm7v7omUqSIXLAxvBLd8oEGtAIbNob4neyoaHz26hxdUglC OftRL1+jf7FVL1SBAAXyzEm5ygDwwW3eGs61nLoEbxl3kl0DFA6gIyA5FKc6Wr4qDzvy 6Qly1wPhBgNmCqtH7eGaaYoBEZSEKBG8xw32lleCM62PsRwd2NR4YBSxOzARf5CQQUym BJNJPRcjXVdcphWN3LEK8f0VSFPoEprVOW/lLghHdAZYBDC1PMrhCqwzBEy4KcjpP8GI QwlQ==
- In-reply-to: <121220212540.ZM30945@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20121221025217.GA19294@chaz.gmail.com> <121220212540.ZM30945@torch.brasslantern.com>
2012-12-20 21:25:40 -0800, Bart Schaefer:
> On Dec 21, 2:52am, Stephane Chazelas wrote:
> }
> } ~$ od -tc < <(<<<a)
> } 0000000 a \n
> } 0000002
> }
> } ~$ od -tc < =(<<<a)
> } 0000000 a
> } 0000001
> }
> } Why the difference?
>
> This appears to be a side-effect of =(<<<a) being optimized for no forking
> in a manner similar to the optimization for $(<file). The subshell spawned
> to be able to read <(<<<a) as a pipe is appending the newline.
>
> I don't know which variation ought to be considered "correct" ...
rc's <<< didn't append that trailing newline. zsh does in every
place but =(<<<xxx) AFAICT, and so do bash and ksh93 (I suppose
they just copied zsh there), so I suppose the only sensible
thing to do now is to add it every time to be consistent as we
can't really go back and don't include it every time.
On the other hand, that would mean that we wouldn't have an
optimized way to write =(echo -n foo) any longer (probably not
too much of an issue since it's quite uncommon to have a file
without a trailing newline)
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author