DEV Community

Discussion on: Bash is a terrible as a programming language, but what's the alternative ?

Collapse
 
steveja profile image
Steve Alexander • Edited

Yes, bash has poor syntax, semantics and the uncontrollable multi-layer evaluation/expansion scheme makes quoting & analyzing scripts a nightmare. But suggesting 'use Python' is a non-starter as it fails to address the intent of a shell.

The purpose of a shell is to allow a user to 'exec' processes with set of arguments, and to 'connect' that process to others so that interaction is possible. For convenience bash performs wildcard expansions of file names, allows various redirections of stdin/out/err (and more), some basic signal handling, performs a little math (awkwardly). Can do a little boolean logic based on things like return codes and file features. It can iterate over numerical indices or string tokens (inflexibly).

Any programming language that intends to replace bash must include this sort functionality; hopefully with much cleaner syntax & semantics.