Yes and no. In a POSIX environment, the utilities must behave as described by the specification. In practice, this means that conforming versions of the utilities must be present in $PATH
. However, when running your program on a POSIX-compliant system, you may be running it in a non-conforming environment. In practice, what often happens is that the OS has a legacy mode and a POSIX mode, and is in the legacy mode by default. Worse than missing some commands, the legacy mode tends to have incompatibilities in them, such as options with different meanings.
You can retrieve a good PATH
with getconf
. Of course, it's tricky, as getconf
in the original $PATH
may not be the right one. The Application Usage for command shows a way to do it:
command -p getconf PATH
As far as I understand the specification, this is not necessary if you are running your program in a POSIX-conforming environment; and if you aren't running your program in a POSIX-conforming environment, POSIX doesn't apply. However, this application usage can be taken as a recommendation: if this doesn't work, you can feel entitled to complain to your vendor that whatever they are doing regarding the letter of the POSIX spec, they are not complying with its spirit.