Answer the question
In order to leave comments, you need to log in
What is better for scripts?
Which is better for scripting for linux, python or bash.
Answer the question
In order to leave comments, you need to log in
It depends on the complexity, depending on the environment. If there is a python and the script is quite complex, of course it is a python. If the script is a pair of sed / awk / exec - bash. Well, if there is no python in the environment (for example, a docker container with nginx) - obviously bash.
Depends on the purpose of the script. The complexity of the task here is not as important as the knowledge of the language and the meaning of the application.
bash is a command language for system tasks. Convenient if you need to run external applications
Python is a universal scripting language.
For example, an installer or a control script is generally better written in bash.
You need to know Bash simply because all control scripts are written on it. Without it, you will never understand why, say, there is an environment variable in this place, but not in that one. A lot of things become simple and understandable if you know it.
python - for heavier scripts, where there is, say, a database connection, complex transformations, work with LDAP / AD ... (I use perl in this case)
I'm afraid that everything you want is already written for you, use DevOps tools for automation, such as ansible, saltstack, etc., if something simple, stop at bash.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question