This week I learned 03
More shell I/O redirection
strace -o >(cmd). I’m still wrapping my head around how this works, but it’s really cool!
My understanding is that >(cmd)
will call pipe(2)
connecting its stdin
to
stdout
of strace(1)
.
Writing something like strace -o >(grep foo) cmd
, will filter the output of
strace(1)
through grep, dumping filtered output to stdout
.
You can emulate this behavior by redirecting stderr
to stdout
and piping it
to grep:
strace cmd 2>&1 | grep foo
As far as I can tell, this accomplishes the same thing as >(grep foo)
.