Can someone put these tools in order of portability? Which of these is certain to be found on even the most minimal *nix systems? Is any of them 100% sure to be present? My guess is that the order is the following:
- awk
- sed
- sh
- perl
While I imagine there are systems which don't default to a bourne shell, some shell will be present as the default, will that always be at /bin/sh
? Presumably not if it's not a bourne-type shell. Both awk
and sed
have pages explaining them on the POSIX specification so presumably they will always be present. Is that so?
Can I be sure that both will be installed on any *nix? Including embedded systems?
Best Answer
sed
,sh
andawk
are portable being specified by POSIX,perl
is not as not being backed by a standard.If you stick to compliant code, there should be no order of portability for the three POSIX commands.
The three POSIX ones along with many other utilities are mandatory for an OS to be POSIX. OSes lacking some of them due to minimization, or providing incomplete/non-conforming implementations do exist though.
Actually, most (if not all) free and open source Unix like operating systems probably would not pass the conformance process should they try to, and they never try anyway.
I would be surprised to find a *nix like OS lacking a Bourne syntax based shell, but anything is possible, especially with embedded systems.
/bin/sh
is likely to be a Bourne syntax family shell but is not guaranteed to be POSIX compliant, even en POSIX compliant systems. For example, it is/usr/xpg4/bin/sh
on Solaris 10 and older while/bin/sh
is the legacy original Bourne shell which is not POSIX.