Skip to content

Pipe stdout and stderr to two separate commands #485

Closed
@mqudsi

Description

@mqudsi

I haven't dug into this too deeply, but by looking through the documentation and testing a few things, it does not seem that it is possible to operate on both stdout and stderr streams simultaneously (but separately)

~>sh -c "echo stdout; echo 1>&2 stderr"
stdout
stderr

~>sh -c "echo stdout; echo 1>&2 stderr" | (or ?(egrep nostdout) true)
stderr

~> sh -c "echo stdout; echo 1>&2 stderr" | or ?(egrep nostdout) ?()
stderr
▶ $ok

~/rand> sh -c "echo stdout; echo 1>&2 stderr" | or ?(egrep nostdout) () 2>&1 | or ?(egrep nostderr) ()
stderr
▶ ?(fail 'egrep exited with 1')

Is it not possible to redirect both?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions