4 ms·
Why not just write something in Python or C#? I don't see a purpose to learning an auxiliary language like Bash anymore when modern high-level languages are so
by jimbob45 4y ago
Why not just write something in Python or C#? I don't see a purpose to learning an auxiliary language like Bash anymore when modern high-level languages are so ergonomic.
- Paul-Craft 4y agoIndeed, at a previous company I worked at, we had a rule: any time a bash script grew to more than 25 lines, it had to be rewritten in Python. I think that was a good rule.
- crowdhailer 4y agoIs there anything else you would consider as a serious alternative to python for filling this niche of scripts greater than 25 lines
- bradknowles 4y agoThere are many such options. This question leads to the classic xkcd standards problem: https://xkcd.com/927/ https://xkcd.com/927/
- Paul-Craft 4y agoSorry, I didn't see this a few days ago. I've been offline for a long weekend :) IMO almost any modern scripting language is totally up to the job of being better than bash for larger scripts. Python, Ruby, Lua, etc. all have facilities to access the filesystem and run external commands while also giving you things like modules and classes as ways to organize your code. The former is essentially table stakes for this kind of job, while the latter is what starts becoming useful once you pass a certain size threshold. 25 lines is, of course an arbitrary threshold, but it seems reasonable enough for me.
- smoldesu 4y agoPython versioning and package management is a mess cross-platform, kinda makes it unattractive for that sorta thing. C# is a decent option for Windows, but dotnet is also a mess on Linux and Mac. Bash "just works" for the majority of UNIX-like systems. Even if you don't have bash installed, there's a good chance you've got a simple interpreter that can run a script file like zsh or sh. There are reasons one might use Python, but I always reach for bash when I'm doing sysadmin or text processing work.