Bash little ape laps and Python programming language advantages and disadvantages

Bash and Python are most automation engineers favorite programming language. They each have their own advantages and disadvantages, it is sometimes difficult choices, so they are the best choice depends on the complexity of the task, the scope of the task, followed by a small circle ape teacher a look at it.

Let's compare these two languages, look at the advantages and disadvantages.

Bash

Is a Linux / Unix shell command language

Well suited to write a shell script using the command line interface (CLI) utility, using the output of a command passed to another command (pipe), and perform simple tasks (can be up to 100 lines of code)

It can be used as command line commands and utilities

Start-up time is faster than Python, but poor execution performance

Windows is not installed by default. Your script may not be compatible with multiple operating systems, but Bash most Linux / Unix system's default shell

Not completely compatible with the other shell (such as csh, zsh, fish).

Via line (|) transmitting CLI utility such as sed, awk, grep reduce performance, etc.

Lacks many functions, objects, data structures, and multithreading support, which limits its use in complex scripts or programming

Lack of good debugging tools and utilities

Python

It is an object-oriented programming language (OOP), so it is more versatile than Bash

It can be used for almost any task

For most operating systems, which are installed by default on most Unix / Linux system

Very similar to the pseudo-code

Simple, clear, easy to read and learn grammar

It has a large number of libraries, documentation and an active community

Provide a more friendly error handling characteristics than Bash

There are more than Bash debugging tools and utilities, which makes it a great language when developing complex software applications involves a lot of lines of code

Application (or script) may contain many third-party dependencies, those dependencies must be installed before execution

For simple tasks, you need to write more code than Bash

I hope these lists allow you to better understand what the language and use it and when.

Using bash or python depending on your needs, what language more in line with your needs, choose which language to go, whether it is bash or python, because as long as the appropriate place, you will use a good, want to solve more development aspects of the doubt, you can go to a small circle ape to learn about, and that may have the answers you seek.

Guess you like

Origin www.cnblogs.com/xiaoyuanquan/p/11016477.html