I looked at two interesting issues today around the ps program in the procps project. One had a solution and the other I’m puzzled about.
ps User-defined Format
Issue #9 was quite the puzzle. The output of ps changed depending if a different option had a hyphen before it or not.
First, the expected output
$ ps p $$ -o pid=pid,comm=comm pid comm 31612 bash
Next, the unusual output.
$ ps -p $$ -o pid=pid,comm=comm pid,comm=comm 31612