zsh-workers
 help / color / mirror / code / Atom feed
* Undocumented construct <<(
@ 2015-11-18 14:23 Klaus Ethgen
  2015-11-18 14:41 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Klaus Ethgen @ 2015-11-18 14:23 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi Guys,

I searched now pretty long for a undocumented construct <<(list). It is
nearly the same than "list | list" but not fully. If you need to process
output of a command via while ... do ... done, it will be a subshell
when using "|" but wont with <<(...). That allows to modify variables
from within the construct.

I think, that should get documented in the man page.

Regards
   Klaus

Ps. I am not subscribed to the list, so please add me in Cc.
- -- 
Klaus Ethgen                              http://www.ethgen.ch/
pub  4096R/4E20AF1C 2011-05-16   Klaus Ethgen <Klaus@Ethgen.ch>
Fingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQGcBAEBCgAGBQJWTInJAAoJEKZ8CrGAGfasfvUL/RUeOjTmCsBrHyr2Tb4WAvoH
pxicJcUUr5tyC3199/AZ78QjxH3WmgpyEKkcFpQPY6ab2v11UfEp552LG29y+FEP
+8y1+KF276Y8QOjaBA9F7yx9IURZnGJTyGiBlOpP5BFgUXbEtk7YEfgz/MVBTjbs
agkLVKp6GjQ2Cdmyu7MkbF/Qo+MiL+U9WO08usv/jLyRZsBePEVAp27ZPNYMPIAy
zq7VB8anrFND5+DH+uGk/y+IhBb5rsWj8wLkgoVt59XI84rFTfG05jRMZ36HGV3h
EEbydBYwF2OGEgnomtp2EkUmfgNqQeYFe5teVTkgOsYxLWzdcrNV69fwEr5YE0a2
YMjeORbmeO8yeQLS6LXyBPEa70qqS6mfkZtbfuCa1qjav+hC51Nzb6/JhCbaZotp
KBYNAQQjhAQ6H3ocTBVoyU6/bm4wtiGyCCtw1BrcLxXPMKfdebXygHUi9TCBKgAk
p9QBd9UM1bYv1H/aSGTbn1QRnS/kVdxMl3BeakxunA==
=Usky
-----END PGP SIGNATURE-----


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

* Re: Undocumented construct <<(
  2015-11-18 14:23 Undocumented construct <<( Klaus Ethgen
@ 2015-11-18 14:41 ` Peter Stephenson
  2015-11-18 14:47   ` Peter Stephenson
  2015-11-18 15:00   ` Klaus Ethgen
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Stephenson @ 2015-11-18 14:41 UTC (permalink / raw)
  To: Klaus+zsh; +Cc: zsh-workers

On Wed, 18 Nov 2015 15:23:08 +0100
Klaus Ethgen <Klaus+zsh@Ethgen.ch> wrote:
> I searched now pretty long for a undocumented construct <<(list).

It's written confusingly (not the first time for a zsh construct :-/).
It's particularly confusing given that "<<HERE" is indeed a special
construct.

What you're looking at is a normal < followed by a <(list),
i.e. redirect stdin from <(list).  So see PROCESS SUBSTITUTION in the
zshexpn manual page for details of <(list).  So yes, indeed, it does
work pretty much like an input pipe with slightly different implications
for job control.

pws


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

* Re: Undocumented construct <<(
  2015-11-18 14:41 ` Peter Stephenson
@ 2015-11-18 14:47   ` Peter Stephenson
  2015-11-18 15:00   ` Klaus Ethgen
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2015-11-18 14:47 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Klaus+zsh, zsh-workers

On Wed, 18 Nov 2015 14:41:47 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:

> On Wed, 18 Nov 2015 15:23:08 +0100
> Klaus Ethgen <Klaus+zsh@Ethgen.ch> wrote:
> > I searched now pretty long for a undocumented construct <<(list).
> 
> What you're looking at is a normal < followed by a <(list),
> i.e. redirect stdin from <(list).

and while I'm sending more emails than necessary, here's a note in the
process substitution documentation.

pws

diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 123722e..564c70d 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -410,6 +410,12 @@ are only expanded when first parsing command or assignment arguments.
 Process substitutions may be used following redirection operators; in this
 case, the substitution must appear with no trailing string.
 
+Note that `tt(<<LPAR())var(list)tt(RPAR())' is not a special syntax; it
+is equivalent to `tt(< <LPAR())var(list)tt(RPAR())', redirecting
+standard input from the result of process substitution.  Hence all
+the following documentation applies.  The second form (with the space)
+is recommended for clarity.
+
 In the case of the tt(<) or tt(>) forms, the shell runs the commands in
 var(list) as a subprocess of the job executing the shell command line.
 If the system supports the tt(/dev/fd)


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

* Re: Undocumented construct <<(
  2015-11-18 14:41 ` Peter Stephenson
  2015-11-18 14:47   ` Peter Stephenson
@ 2015-11-18 15:00   ` Klaus Ethgen
  2015-11-18 22:55     ` Daniel Shahaf
  1 sibling, 1 reply; 5+ messages in thread
From: Klaus Ethgen @ 2015-11-18 15:00 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

Am Mi den 18. Nov 2015 um 15:41 schrieb Peter Stephenson:
> On Wed, 18 Nov 2015 15:23:08 +0100
> Klaus Ethgen <Klaus+zsh@Ethgen.ch> wrote:
> > I searched now pretty long for a undocumented construct <<(list).
> 
> It's written confusingly (not the first time for a zsh construct :-/).

:-)

> It's particularly confusing given that "<<HERE" is indeed a special
> construct.
> 
> What you're looking at is a normal < followed by a <(list),

Yes, that is the same. I just wasn't aware that it also work for the
special <(...) construct.

Nevertheless, thanks for the fast response and for documenting it.

For the records, I fixed zsh.vim to allow that syntactical sugar:
- --- /usr/share/vim/vim74/syntax/zsh.vim 2015-08-17 03:23:35.000000000 +0100
+++ zsh.vim     2015-11-18 15:44:37.885885225 +0100
@@ -55,7 +55,7 @@
 syn match   zshRedir            '|&\='
 
 syn region  zshHereDoc          matchgroup=zshRedir
- -                                \ start='<\@<!<<\s*\z([^<]\S*\)'
+                                \ start='<\@<!<<\s*\z([^<(]\S*\)'
                                 \ end='^\z1\>'
                                 \ contains=@zshSubst
 syn region  zshHereDoc          matchgroup=zshRedir

Maybe that can find a way into vim in some future time too. :-)

Regards
   Klaus
- -- 
Klaus Ethgen                              http://www.ethgen.ch/
pub  4096R/4E20AF1C 2011-05-16   Klaus Ethgen <Klaus@Ethgen.ch>
Fingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQGcBAEBCgAGBQJWTJJtAAoJEKZ8CrGAGfasfvMMAKj1wrkbhqTgadiCrkoSmJdP
lI+oG48ccq5gmF7vNrOzWBJvBE4R1tFv/BqLyfjZXaRZzf9Yz3MDcLAdZgOzR3+K
wnN8RdO0WIt2iFClJME+XRhsgIlQ3UIn27WbWq0YgpGU7NHTOtJ0aDJBLTwSRgtN
N5bAVylQrX9BGjnVsgj+vJ2NbI1FiAFkLT38pk+vZA2JWKmqJb+YhdmfthOE/fxw
9tg+QF6YOKIYkKLMLjjRjSkA6s6iePiMr6dLMUMn04YjDKS88Aw7qKS3dJ020M1R
sqAg3tYUDWGU/peMCDUfVPo3mavn9TO640m7Q8A41XHskHW6tiZbl/jhorCF/idS
1W3YrBgY5RSPDF4cnslut+OCNrPBqckBhg80lMTrA+pGfAkgIWpxqSau7lWZ6gLj
hFl/BEgHIn1LoLW1ItfpMY0Jy9+sV/w73q1xyfcz8z0fIfZth9w42Ja7lx8IjQ9g
d9kXNUTkAw6/6ILHeAa7RKh2sEqgcqlbuooiHHEtRw==
=E+Mu
-----END PGP SIGNATURE-----


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

* Re: Undocumented construct <<(
  2015-11-18 15:00   ` Klaus Ethgen
@ 2015-11-18 22:55     ` Daniel Shahaf
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Shahaf @ 2015-11-18 22:55 UTC (permalink / raw)
  To: Klaus Ethgen; +Cc: zsh-workers

Klaus Ethgen wrote on Wed, Nov 18, 2015 at 16:00:03 +0100:
> For the records, I fixed zsh.vim to allow that syntactical sugar:

You should send that to the maintainer of zsh.vim — see line 3 in the
file.


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

end of thread, other threads:[~2015-11-18 22:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-18 14:23 Undocumented construct <<( Klaus Ethgen
2015-11-18 14:41 ` Peter Stephenson
2015-11-18 14:47   ` Peter Stephenson
2015-11-18 15:00   ` Klaus Ethgen
2015-11-18 22:55     ` Daniel Shahaf

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