Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: parse error in process substitution



On Mon, 10 Nov 2008 15:42:59 +0100
Louis-David Mitterrand <vindex+lists-zsh-users@xxxxxxxxxxx> 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@xxxxxxxxxxxxxx tail -F /var/log/kern.log),red, \
> <(ssh root@xxxxxxxxxxxxxx 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@xxxxxxxxxxxxxx tail -F /var/log/kern.log) ,red, \
  <(ssh root@xxxxxxxxxxxxxx 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@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author