zsh-users
 help / color / mirror / code / Atom feed
* parse error in process substitution
@ 2008-11-06 15:02 Louis-David Mitterrand
  2008-11-06 16:25 ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Louis-David Mitterrand @ 2008-11-06 15:02 UTC (permalink / raw)
  To: zsh-users

Hi,

Why do I get:

	zsh: parse error in process substitution

when running this command (wich works fine in bash):

root-tail --geometry 1920x1200+0+0 \
--font '-misc-fixed-*-r-*-*-10-*-*-*-*-*-*-15' --wordwrap \
~/.xsession-errors,yellow, \
/var/log/syslog,white, \
/var/log/apache2/error.log,orange, \
<(ssh root@my.host.name tail -F /var/log/kern.log),red, \
<(ssh root@my.host.name tail -F /var/log/apache2/error.log),pink, &

Plus my terminal becomes all slow an treacly after that.

ZSH_VERSION=4.3.6

Thanks,

-- 
http://www.lesculturelles.net


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

* Re: parse error in process substitution
  2008-11-06 15:02 parse error in process substitution Louis-David Mitterrand
@ 2008-11-06 16:25 ` Bart Schaefer
  2008-11-10  8:21   ` Louis-David Mitterrand
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2008-11-06 16:25 UTC (permalink / raw)
  To: zsh-users

On Nov 6,  4:02pm, Louis-David Mitterrand wrote:
} Subject: parse error in process substitution
}
} 	zsh: parse error in process substitution

Because <(...) isn't really a parse element all by itself, so zsh is
trying to parse "(...),red," as a word, and not succeeding.

Note that the zsh documentation says that "<(...)" becomes a separate
command word -- this has been discussed before, check list archives --
so even if it were parsed successfully your command would receive the
two arguments /dev/fd/11 ,red, not the single argument /dev/fd/11,red,
(for example).

} Plus my terminal becomes all slow an treacly after that.

I don't know what might cause anything matching that description.


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

* Re: parse error in process substitution
  2008-11-06 16:25 ` Bart Schaefer
@ 2008-11-10  8:21   ` Louis-David Mitterrand
  2008-11-10 14:28     ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Louis-David Mitterrand @ 2008-11-10  8:21 UTC (permalink / raw)
  To: zsh-users

On Thu, Nov 06, 2008 at 08:25:17AM -0800, Bart Schaefer wrote:
> On Nov 6,  4:02pm, Louis-David Mitterrand wrote:
> } Subject: parse error in process substitution
> }
> } 	zsh: parse error in process substitution
> 
> Because <(...) isn't really a parse element all by itself, so zsh is
> trying to parse "(...),red," as a word, and not succeeding.
> 
> Note that the zsh documentation says that "<(...)" becomes a separate
> command word -- this has been discussed before, check list archives --
> so even if it were parsed successfully your command would receive the
> two arguments /dev/fd/11 ,red, not the single argument /dev/fd/11,red,
> (for example).

So how would you convert that working bash command to zsh?

	root-tail <(ssh root@my.host.name tail -F /var/log/kern.log),red,

Thanks,

-- 
http://www.critikart.net


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

* Re: parse error in process substitution
  2008-11-10  8:21   ` Louis-David Mitterrand
@ 2008-11-10 14:28     ` Peter Stephenson
  2008-11-10 14:32       ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2008-11-10 14:28 UTC (permalink / raw)
  To: zsh-users

On Mon, 10 Nov 2008 09:21:52 +0100
Louis-David Mitterrand <vindex+lists-zsh-users@apartia.org> wrote:
> So how would you convert that working bash command to zsh?
> 
> 	root-tail <(ssh root@my.host.name tail -F /var/log/kern.log),red,

Something like

  root-tail-procsub-internal() {
    root-tail ${1},$2
  }

  root-tail-procsub() {
    root-tail-procsub-internal <(eval $1) $2
  }

and then call

  root-tail-procsub 'ssh root@my.host.name tail -F /var/log/kern.log' ,red,

or variations.

It would be good to fix the underlying problem; it will work a little
differently from the way it is now, but that's so confusing if the <(...)
isn't in a separate word that I don't think there's a good reason to keep
it.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: parse error in process substitution
  2008-11-10 14:28     ` Peter Stephenson
@ 2008-11-10 14:32       ` Peter Stephenson
  2008-11-10 14:42         ` Louis-David Mitterrand
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2008-11-10 14:32 UTC (permalink / raw)
  Cc: zsh-users

Peter Stephenson wrote:
> Something like
> 
>   root-tail-procsub-internal() {
>     root-tail ${1},$2
>   }
> 
>   root-tail-procsub() {
>     root-tail-procsub-internal <(eval $1) $2
>   }
> 
> and then call
> 
>   root-tail-procsub 'ssh root@my.host.name tail -F /var/log/kern.log' ,red,
> 
> or variations.

Actually, come to think of it, there's no obvious gain over the simpler

  root-tail-args() {
     root-tail ${1},$2
  }

  root-tail-args <(ssh root@my.host.name tail -F /var/log/kern.log) ,red,

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: parse error in process substitution
  2008-11-10 14:32       ` Peter Stephenson
@ 2008-11-10 14:42         ` Louis-David Mitterrand
  2008-11-10 14:55           ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Louis-David Mitterrand @ 2008-11-10 14:42 UTC (permalink / raw)
  To: zsh-users

On Mon, Nov 10, 2008 at 02:32:51PM +0000, Peter Stephenson wrote:
> Peter Stephenson wrote:
> > Something like
> >
> >   root-tail-procsub-internal() {
> >     root-tail ${1},$2
> >   }
> >
> >   root-tail-procsub() {
> >     root-tail-procsub-internal <(eval $1) $2
> >   }
> >
> > and then call
> >
> >   root-tail-procsub 'ssh root@my.host.name tail -F /var/log/kern.log' ,red,
> >
> > or variations.
>
> Actually, come to think of it, there's no obvious gain over the simpler
>
>   root-tail-args() {
>      root-tail ${1},$2
>   }
>
>   root-tail-args <(ssh root@my.host.name tail -F /var/log/kern.log) ,red,

Thanks for your suggestion Peter. But when invoking root-tail on
several log files (typical usage) it doesn't scale:

root-tail --geometry 1920x1200+0+0 --wordwrap \
~/.xsession-errors,yellow, \
/var/log/syslog,white, \
/var/log/apache2/error.log,orange, \
<(ssh root@my.server.name tail -F /var/log/kern.log),red, \
<(ssh root@my.server.name tail -F /var/log/apache2/error.log),pink, &

etc...

Cheers,

--
http://www.critikart.net


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

* Re: parse error in process substitution
  2008-11-10 14:42         ` Louis-David Mitterrand
@ 2008-11-10 14:55           ` Peter Stephenson
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Stephenson @ 2008-11-10 14:55 UTC (permalink / raw)
  To: zsh-users

On Mon, 10 Nov 2008 15:42:59 +0100
Louis-David Mitterrand <vindex+lists-zsh-users@apartia.org> wrote:
> Thanks for your suggestion Peter. But when invoking root-tail on
> several log files (typical usage) it doesn't scale:
> 
> root-tail --geometry 1920x1200+0+0 --wordwrap \
> ~/.xsession-errors,yellow, \
> /var/log/syslog,white, \
> /var/log/apache2/error.log,orange, \
> <(ssh root@my.server.name tail -F /var/log/kern.log),red, \
> <(ssh root@my.server.name tail -F /var/log/apache2/error.log),pink, &

Looks like you should be able to do something like (only partially tested):

  root-tail-sub() {
     integer i
     local -a args
  
     for (( i = 1; i <= ${#argv}; i++ )); do
        args+=($argv[i])
        if [[ ${argv[i]} = (/dev|/proc)/* ]]; then
          args[-1]+=$argv[++i]
        fi
     done
  
     root-tail "${args[@]}"
  }
  
  root-tail-sub --geometry 1920x1200+0+0 --wordwrap \
  ~/.xsession-errors,yellow, \
  /var/log/syslog,white, \
  /var/log/apache2/error.log,orange, \
  <(ssh root@my.server.name tail -F /var/log/kern.log) ,red, \
  <(ssh root@my.server.name tail -F /var/log/apache2/error.log) ,pink, &

Note the spaces after the <(...) substitutions.  The function assumes that
anything substituted to a file name beginning /proc/ or /dev/ has come from
that and appends the following argument.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

end of thread, other threads:[~2008-11-10 15:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-06 15:02 parse error in process substitution Louis-David Mitterrand
2008-11-06 16:25 ` Bart Schaefer
2008-11-10  8:21   ` Louis-David Mitterrand
2008-11-10 14:28     ` Peter Stephenson
2008-11-10 14:32       ` Peter Stephenson
2008-11-10 14:42         ` Louis-David Mitterrand
2008-11-10 14:55           ` Peter Stephenson

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