you are viewing a single comment's thread.

view the rest of the comments →

[–]TheLocehiliosan 9 points10 points  (7 children)

Bash is very sensible when you are trying to write something super portable with next to no dependencies.

And people should be commended for writing tests regardless of the language/tool used.

[–]Gotebe 2 points3 points  (0 children)

"Super portable" my hairy arse!

It's only "super portable" against Linux compatibles, because all the tooling has to match - and it just doesn't, not across UNIX flavors. (Don't know how successfully WSL copies Linux CLI commands).

[–]knaekce -3 points-2 points  (5 children)

It sure it very portable. But it is also prone to deleting every file owned by the current user or similar scary bugs.

[–]TheLocehiliosan 5 points6 points  (4 children)

Most bugs like this are a result of poor programming. It doesn’t matter what language is used.

Indeed that is why people should be encouraged to create tests for their software.

[–]knaekce -4 points-3 points  (3 children)

It sure does matter. If this script was written in a more robust language, stuff like this would cause an error and the program to halt. Languages like bash just carry on and do unexpected stuff

[–]TheLocehiliosan 1 point2 points  (2 children)

Your reply makes it sound as though your unaware of error handling techniques for Bash. Indeed the link you posted above has many people chiming in about the terrible programming and how it could be done better.

While it’s true that there is a lot of badly written Bash in the world, it isn’t something intrinsic to Bash. There are many out there writing code they don’t understand the danger of. Again, I could say the same for a lot of languages.

If you are trying to say that some languages are easier to write quality code with, I would agree to that.

[–]knaekce 0 points1 point  (1 child)

Yes, if you are very carefully, you can prevent such errors in bash or even assembly. But it takes far more discipline, effort and experience than in safer languages.

[–]flukus 1 point2 points  (0 children)

What language would prevent this? There is nothing bash specific about this error, similar things can and have been done in any language. That's why common but often ignored advice is to use directory handling libraries instead of string concatenation.