Hacker News new | ask | show | jobs
by chasil 786 days ago
> The current POSIX standard defines source code-level compatibility for only two programming languages: The C language (C99) and the command language (shell).

AWK is also defined in the standard.

Yes, subtleties are lost here.

2 comments

It's a good point! I've addressed it.

I referred here to the following definition:

"2.4 Other Language-Related Specifications POSIX.1-2017 is currently specified in terms of the shell command language and ISO C. Bindings to other programming languages are being developed."

But, you are definitely right that some of the tools, defined as standard "utilities", such as AWK, also have their own language. Although, it is only defined in the "utilities" section, https://pubs.opengroup.org/onlinepubs/9699919799/utilities/a... However, "sh" is also defined under "utilities", although it has an extensive language specification that is provided as a separate document.

The motivation for the standard, in the fear of a Sun-AT&T alliance, is also an elephant in the room.
sed is also a Turing-complete language.
Interesting! I just wonder... How would you do a conditional branching in sed?
There is a conditional branch instruction in sed that is taken if the last substitute command was successful.

The O'Reilly book on sed & awk is available online for free from various sources (I grabbed a rar archive of it from somewhere).

https://freecomputerbooks.com/The-Unix-CD-Bookshelf-Version-...