zsh-workers
 help / color / mirror / code / Atom feed
From: "Sullivan N. Beck" <sbeck@cise.ufl.edu>
To: zsh-workers@sunsite.auc.dk
Subject: Bug report + feature request
Date: Thu, 05 Oct 2000 14:11:21 -0400	[thread overview]
Message-ID: <20001005181121.ADB45DCE4@mail.cise.ufl.edu> (raw)


I have found a bug in zsh.  I've got access to:
   zsh 3.1.5  on Solaris 2.6
   zsh 3.1.9  on Solaris 8, redhat 6.2, irix 6.5
and each of these suffers from the problem.

Basically, I want to switch STDOUT and STDERR so I pipe STDERR to some
other commands.  The following lines show what's happening to prevent me
from doing this (though I can do it in sh/ksh distributed with Solaris).

   echo '=1 ====='
   echo
   ls -l /tmp/z   | while read line ;do echo ":: "$line; done
   echo
   echo '=2 ====='
   echo
   ls -l /tmp/z/a | while read line ;do echo ":: "$line; done
   echo
   echo '=3 ====='
   echo
   ls -l /tmp/z   3>&1 1>&2 2>&3 | while read line ;do echo ":: "$line; done
   echo
   echo '=4 ====='
   echo
   ls -l /tmp/z/a 3>&1 1>&2 2>&3 | while read line ;do echo ":: "$line; done

produce

   =1 =====
   
   :: total 16
   :: -rw-r--r--   1 sbeck    apps         396 Oct  5 13:44 foo
   
   =2 =====
   
   /tmp/z/a: No such file or directory
   
   =3 =====
   
   total 16
   -rw-r--r--   1 sbeck    apps         396 Oct  5 13:44 foo
   :: total 16
   :: -rw-r--r--   1 sbeck    apps         396 Oct  5 13:44 foo
   
   =4 =====
   
   :: /tmp/z/a: No such file or directory

Notice that in the 3rd section, the output from the command ends up on
both STDOUT and STDERR.  All other shells (ksh, sh, bash) that I tested
give the correct output for the 3rd case:

   total 16
   -rw-r--r--   1 sbeck    apps         396 Oct  5 13:44 foo



Now for the feature request.  Since I'd actually like to separate and
pipe STDOUT and STDERR separately to different commands (all of the
above came about from various attempts to get this working) without
resorting to fifos, intermediate files, etc., what I'd _really_ like to
do is to be able to pipe different file descriptors similar to how I can
redirect them to a file.  For example, I'd like to replace the following
lines:

  COMMAND > /tmp/stdout 2> /tmp/stderr
  cat /tmp/stderr | STDERR_COMMAND
  cat /tmp/stdout | STDOUT_COMMAND

with the single line:

  COMMAND >| STDOUT_COMMAND 2>| STDERR_COMMAND

If this syntax isn't acceptable, that's fine with me.  Any syntax is
fine.  I'd just like the functionality.



Please reply to me as well as the list since I'm not currently subscribed
to this list.


--------------------------|  Sullivan Beck  |---------------------------
mailto:sbeck@cise.ufl.edu          |            Senior System Programmer
http://www.cise.ufl.edu/~sbeck     |               University of Florida
PH : (352) 392-1057                |                     CISE Department
Fax: (352) 392-1220                |                            CSE 314E
------------------------------------------------------------------------


             reply	other threads:[~2000-10-05 18:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-05 18:11 Sullivan N. Beck [this message]
2000-10-05 18:32 ` Peter Stephenson
2000-10-06  8:24 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20001005181121.ADB45DCE4@mail.cise.ufl.edu \
    --to=sbeck@cise.ufl.edu \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).