Discussion on: Most Esoteric Language You've Used

ahferroin7 profile image
Austin S. Hemmelgarn

This is just my perspective, but despite bash (and POSIX shell scriptt in a more general sense) being widely used and relatively well known, I'd actually still consider it a somewhat esoteric language simply because of how drastically different it is from most mainstream programming languages.

There are all kinds of strange quirks and odd holdovers from the largely organic development of the language which make it difficult for people to learn and use in a lot of cases. Examples of this that come to mind include:

  • It's comparatively trivial to use computed variable names without using maps/dictionaries/hashes.
  • A large number of metacharacters have behavior that's dependent on their context, sometimes including what adjacent whitespace they have (see ! in the context of the conditional in an if statement for a really good example, depending on the exact shell and how you put whitespace around it, it's either a command history lookup, a negation of the condition, or a syntax error).
  • Statements resulting in errors don't terminate the script executing them (except that on some rare occasions they actually do) unless you configure the shell to have them work that way.
  • Controlled error propagation requires a non-negligible amount of code and has no side-channel (you can only do it through return codes or variables, there is no dedicated concept of an exception/error that can be caught like in many languages).
  • Errors in pipelines are dependent on later commands in the pipeline for error propagation, and most commands just eat the error.
Thread Thread
jldohmann profile image
Jesse Author

Loved reading this comment, thanks for sharing all this!