How portable is the `ps` command?

I am making a bash script and I would like to make sure it is portable. For context, the command will be part of the tmux-resurrect plugin .

I want to use this command: ps -eo ppid,command

. Is this command portable?

I would also love to hear how to test this. For example: maybe there is a service that can test commands on a large number of operating systems, etc.?

+3


source to share


1 answer


The POSIX standard is publicly available on the Internet. Yes, ps is one of the standardized utilities. If you stick with the default settings, you should be fairly portable.



Note, however, that forcing some utilities to behave correctly may require setting certain environment variables. In particular, systems using the GNU utilities may require POSIXLY_CORRECT=yes

or a similar set.

+1


source







All Articles