Sys V or BSD derivated UNIX

I read it was possible to distinguish if UNIX system on the machine is derivated from Sys V or BSD. The instruction said:

ps -ef ... is functional on Sys V
ps ax ... is functional on BSD

But since I don't have any UNIX machine (just Linux) I can't tell how I may use this knowledge in my script.

My idea is that ps -ef returns non-zero exit code on BSD and ps ax returns non-zero exit code on Sys V.

Is my idea right?

Thank you

(it's a question rather more theoretical than practical, I need it to school)

On BSD both -ef and ax return 0 on exit.
A successful command returns a 0, while an unsuccessful one returns a non-zero value that usually may be interpreted as an error code.

So that I have to check the error message from ps on BSD to distinguish it from Sys V?

I know. But I don't know what part of my message made you to write it.

The BSD part, for Sys V you have to digg for yourself.

In theory this might work, but all "real existing" UNIXes are some sort of "best of both worlds" nowadays.

AIX (as well as HP-Ux and as far as i know SunOS) will understand both syntaxes, "ps -ef" as well as "ps caux".

the same goes (in AIX, other UNIX dialects i do not know in-depth) for the printing/queue management subsystem, which is different in SysV and BSD. In AIX both the SysV variant and the BSD variant are understood, because both command groups are only frontends to a AIX-native subsystem, which is different from both.

There are 100%-BSD implementations out there (netBSD and FreeBSD for instance), but i do not know of any pure SysV-implementation that is worth noticing. (SCO? Please, have mercy....). So probably the best real-world-approach is to look into the output of "uname" and decide based on a translation table. Still I'd think that this distinction is merely academic nowadays, for reasons given.

I hope this helps.

bakunin

Thank you very much