DEV Community

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

Collapse
 
iseiryu profile image
Sergey

IMO Bash is a weak command interpreter. I got comfortable with it over the years and can read the man pages when needed. It's still a terrible experience that we, as the developer community, should push to improve.

There are no common bash/sh standards across multiple utilities, built-in facilities, different OSs. Utilities and their flags are named with "I feel like this letter today" approach. They mean different things on different operating systems. You need a lot of utilities and curl/wget/apt-get commands to add them (even for jq) to do any more or less serious setup on a medium-large project.

My choice is pwsh. It's easy to install on all major OSs. It's very well documented and the documentation is in a single place. It has clear flag names. It has text parsers for JSON, CSV, XML, HTML and other formats out of the box. It can connect to DBs out of the box. It has full access to the whole dotnet framework (gazillion of features). It's a first class citizen on Azure.

learn.microsoft.com/en-us/powershell/

Collapse
 
platoxia profile image
Platoxia

I'd like to preface this by saying that I am not proselytizing Bash, Unix, etc, or trying to disparage other systems or projects. That said, It seems like what you are comparing are disparate systems.

Bash, while POSIX compliant, is part of the GNU project, with tools that have many extensions on top of POSIX. Other similar projects have done the same and the extensions, of course, cannot be expected to all have the same command line switches since, as you say, there is no common standard beyond POSIX.

That said, the GNU project certainly has made attempts to standardize the command line switches among all the individual tools within their own project by adding long-options, while the short options that emulate the original Unix tools are the same as would be expected by the original tools, AFAIK.

What you describe as cohesiveness among the Microsoft tools should be expected by any project, and is largely true for all of them, respectively.

The inconsistencies you mention are mostly the result of disparate projects that have provided extensions to the POSIX standards.

I may be wrong about any of this, as I am not an expert historian of technology, and please correct me if I am. This is my understanding of the differences you mentioned.

Thread Thread
 
iseiryu profile image
Sergey

I understand the historical reasons but it doesn't eliminate the fact that bash is a lot harder to learn and to maintain than pwsh once scripts get passed simple cd, ls, cat stuff.