Bash: Split stdout from multiple concurrent commands into columns

前端 未结 3 1340
一生所求
一生所求 2021-02-06 08:53

I am running multiple commands in a bash script using single ampersands like so:

commandA & commandB & commandC

They each have their ow

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 09:11

    Regrettably answering my own question.

    None of the supplied solutions were exactly what I was looking for. So I developed my own command line utility: multiview. Maybe others will benefit?

    It works by piping processes' stdout/stderr to a command interface and then by launching a "viewer" to see their outputs in columns:

    fooProcess | multiview -s & \
    barProcess | multiview -s & \
    bazProcess | multiview -s & \
    multiview
    

    This will display a neatly organized column view of their outputs. You can name each process as well by adding a string after the -s flag:

    fooProcess | multiview -s "foo" & \
    barProcess | multiview -s "bar" & \
    bazProcess | multiview -s "baz" & \
    multiview
    

    There are a few other options, but thats the gist of it.

    Hope this helps!

提交回复
热议问题