top | item 44126273

(no title)

flmontpetit | 9 months ago

I used to work for a .NET shop that randomly wrote some automation scripts in bash. The expertise to maintain them long term (and frankly, write them half-decently to begin with) simply wasn't there. Never understood why they didn't just write their tooling in C#.

Maybe this will make it seem like a more viable approach.

discuss

order

JamesSwift|9 months ago

Or just use powershell. It has some idiosyncrasies but its a pretty nice platform for scripting

shagmin|9 months ago

Especially for C# developers. You can use any CLR (e.g. C#) objects in powershell, for prototyping, automation, proof of concept, etc.,.

moomin|9 months ago

Here’s the really annoying thing with powershell: it doesn’t have a module distribution model. Like, at all. A csharp script, on the other hand, gets NuGet out of the box.

noodletheworld|9 months ago

It is reasonably unlikely that bash scripts are easily replaceable by powershell scripts.

Theres a fair argument that complex scripts require a complex scripting language, but you have to have a good reason to pick powershell.

Typically, on non-windows, there is not one.

Its the same “tier” as bash; the thing you use because its there and then reach past for hard things. The same reason as bash.

Theres no realistic situation I would (and Ive written a lot of powershell) go, “gee, this bash script/makefile is too big and complex, lets rewrite it in powershell!”

psyclobe|9 months ago

Bash is the tool that’s already there; that is always a real good reason to use it.

Dotnet is a pig with its dependencies by comparison.

dragonwriter|9 months ago

> Bash is the tool that’s already there; that is always a real good reason to use it.

If you are a dotnet dev shop, it is quite likely that dotnet is also a tool that is already there the places you need automation.

Plus, its also the tool that is already there in your team’s skillset.

crote|9 months ago

Sure, but these days so is Python. And you've got a dozen other languages available after a single command. You wouldn't recommend using a kitchen knife instead of a chainsaw to cut down a tree just because it's already there, would you?

Bash has a huge number of footguns, and a rather unusual syntax. It's not a language where you can safely let a junior developer tweak something in a script and expect it to go well. Using a linter like ShellCheck is essentially a hard requirement.

If you're working in a team where 99.9% of the code you're maintaining is C#, having a handful of load-bearing Bash scripts lying around is probably a Really Bad Idea. Just convert it to C# as well and save everyone a lot of trouble.

Ray20|9 months ago

>Dotnet is a pig with its dependencies by comparison.

Dotnet with all dependencies you will get in how much time? In like 6 minutes including all the preparations? So the difference between "already there" and dotnet - is 6 minutes. It's hard to imagine a case where this difference matters.

jayd16|9 months ago

Its trivial to install a consistent PowerShell environment on the major OSes. Not so for Bash.