Den tis 3 jan. 2023 kl 18:28 skrev Dan Cross <crossd(a)gmail.com>:
A few years ago, I was having lunch with some folks
from the Go team
and one of them remarked, "you shouldn't write a shell script that's
longer than about 10 lines. Once you do, it's time to rewrite it in a
real programming language." I was a bit taken aback, but they had a
point. I'll note that Go standardized on using bash everywhere.
They wouldn't like my current project. It's a whole bunch of different
shell scripts (and they use bash-isms, since it's inconceivable that anyone
would use them on a non-Linux non-GNU system) calling each other as
modules. The scripts aren't HUGE, but they're certainly a lot more than 10
lines.
I work for an academic supercomputing facility, and we have a corporate
customer using our systems to do aerodynamics calculations. They want a way
to automatically submit jobs on our systems from their own environment,
complete with transferring the source data files to us and the results
files back to them when they're done. They're integrating that with their
own set of scripts (a lot of Python, I believe) so an aerodynamics engineer
can just pick an option from a menu and everything works automagically. I'd
say bash works pretty well for that application. It's a lot of calling
external programs (scp, sbatch (the command to submit a SLURM job, SLURM
being the batch management facility a lot of large compute clusters use to
manage their jobs), etc).
I inherited this set of scripts from someone who quit before I joined in
2020, and have modified them extensively since then to work well with the
corporate customer's scripts and be more generic. It's in a fully working
state at this point, but I still have some feature requests to take care of.
I am more of a sysadmin than a developer, but I certainly can write code
when the situation warrants. Pure Windows sysadmins often can't write code
at all (though there are certainly some who are very conversant with
PowerShell) but I'd say any UNIX/Linux sysadmin worth their salt can at
least write shell scripts, and often Python, or some years back, Perl.
Niklas