Scripting/automation method/language

Joseph Sinclair plug-discussion at stcaz.net
Fri Jan 7 13:20:07 MST 2022


A lot depends on complexity.
A few questions:
1) Is this easier to understand, or harder to understand as Bash
2) Is it more or less work to maintain as Bash versus a more general purpose language
3) What options exist for general purpose languages to accomplish the task

Depending on answers to these, you might stay with Bash, if it's not too hard to follow and not too much more work to maintain.
If you have large and/or complex processing, you might want to use something like Perl (which is a required core system dependency for most distributions), Awk, or Python.
Depending on other software routinely installed on the systems, you might also have the option to use Go, or anything that compiles to LLVM.
You might also find that Python is already installed; perhaps just with the binary named python3 or similar.  I don't know of too many distributions that don't require python currently.
You might also package the scripts with any required dependencies (languages like Python or larger toolsets like Ansible and Terraform) in a container, and run the contained package in open mode (e.g. like a flatpak) on the destination system.  This has the added advantage that these management scripts can be read in, executed, then removed cleanly as needed; reducing the need to keep yet another item up to date on the machines.


On 2022-01-07 11:21 AM, Seabass via PLUG-discuss wrote:
> Hello Linux folk.
> 
> I'm making some bash scripts, mostly for templating purposes.
> In the past, I've used bash scripts to make basic configs of systems.
> 
> Eventually I went to ansible, but came across trouble pushing to some OSs, as 
> they needed python installed to work with ansible, but was not installed by 
> default. (I might be misremembering the tool used if this is wrong, but this 
> doesn't matter too much)
> 
> I am asked the obvious question of "if you are templating entire files, why 
> aren't you using something *other* than bash like python?".
> 
> My answer was that my computer doesn't have python installed, and though I know 
> most do, I don't want to force admins to install python (and get root 
> permissions and approval by the security team to install and etc...) to use my 
> utility. I'd rather it be usable immediately, which means it will always be 
> usable if written in bash.
> 
> So I ask you admins and general users this: what do you think about this situation?
> 
> Is it worth writing the program in python for possibly more readable and easier 
> to write/maintain code?
> Or is shell scripting more worth it for the accessibility to any POSIX system 
> without need for extra work to install, run, then uninstall afterward any other 
> scripting language?
> Is this situation rare?
> Or is the answer just going to be different dependent on what the scripts do?
> 
> What do you think?
> 
> 
> 
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> https://lists.phxlinux.org/mailman/listinfo/plug-discuss
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20220107/d42b9df5/attachment.sig>


More information about the PLUG-discuss mailing list