Portable Operating System Interface / POSIX

POSIX is an ancient standard, a (failed) attempt to keep all the UNIX versions compatible back in 1988 — more than four decades ago.

When Linux and BSD came out they decided they would play as nicely as they could, but would not put up with the snail’s pace of innovation in the POSIX standard and neither should you.

📰 The same thing happened with the Mozilla web browser adding background, blink, and a host of other HTML elements; and the W3 Working Group splitting from W3C. Standards can be good but they can also destroy progress. At this point writing 40-year-old POSIX compliant anything is the latter.

💢 The dumbest, most annoying invocation of “POSIX compliance” is the ridiculously bad/slow/stupid use of sed, awk, bc, seq, tr, expr, cut and their ilk. None of these are needed with modern Bash 4.4+.

The Only OS Standards That Matter: Linux and BSD

Most of the world runs on GNU/Linux and BSD. The only thing you should ever worry about is compatibility with the last LTS release of either of these. Anything more is wasted cognitive overhead.

POSIX is Dead

Recognize any of these?

Yeah, didn’t think so. I’ll bet only AIX and Solaris have any machines still alive out there buried in the bowels of massive corporate dungeons supported by the weight of decades of technical debt bearing down on them from the ancient stone walls all around them. You get the idea.

America’s nuclear arsenal still runs on floppy disks.

Do you want to be anywhere near those organizations?


That’s right. I see you are a very intelligent technologist.

But the answer is actually,

Correct response to any job with AIX, Solaris, or HP-UX.

Correct response to any job with AIX, Solaris, or HP-UX.

And if anyone tries to entice you into working at one of these career killing places you should run screaming and warn all those you know and love about the vampirous beast looking for vibrant souls to suck down its undead gullet.

Performance and Portability are Still Alive

Just because POSIX is dead doesn’t mean we should not be concerned with startup times — the reason dash and ash exist.

Portability just makes common sense. We can still make most of ls options work the same way. Maintaining compatibility doesn’t require a standard, just a brain that — like — works.

Opposition from Crusty Old Religious Zealots

The words I have just written above will throw certain individuals into a massive rage — mostly because they know it is true and cannot deal with the cognitive dissonance that has calcified into their diseased minds.

I know, I used to be one.

I was so influenced by having to write POSIX shell at IBM for 10 years that had to run on 10s of thousands of different UNIX and Linux machines that it practically became a religion to me — as it has for many others.

But the cult of POSIX has reached a Jim Jones kool-aide level of crazy. Time for us to save as many as we can and let the other zombies succumb to Darwin’s laws.

Your Grandpa Wants His POSIX Shell Scripts Back

There’s a lot of outdated crap advice on StackExchange and the rest of the Internet. Here’s what you really need to know.

Defunct Commands

Using any of the following out-of-date, defunct commands just shows how uninformed, old, or stupid you are: sed, awk, tr, cut, cat, expr, bc, dc, seq.

All of these can be replaced with Bash 4.4+.

This isn’t a matter of opinion. It’s a matter of objective efficiency.

What’s even worse is that it’s been discovered that every time you unnecessarily fork a sub-shell a cute animal dies somewhere that you will never see. It’s true. That’s how toxic these commands are today.

Do the right thing. Don’t kill cute animals with your idiocy.

Then again, maybe you’re a sadist troll. God knows the world is full of them right now.

💬 Notice that perl is not in the list. Using sed -i also shows how stupid you are. Perl defined the current standard in regular expression matching. You should always use perl -i instead of sed -i for anything that needs it, for example perl -p -i -e 's/foo/bar/g' **/* to recursively find and replace foo with bar. Perl is far more safe and powerful than sed for such things. Yes it’s bigger, but when you actually need something besides Bash perl should be the first thing you reach for — not Python, which actually loads libpcre.so which is Perl’s own regular expression library. Perl also replaces any awk stuff you might think you need.