Because the shell appears to be a common feature between UNIX systems and is standardized by POSIX.
As a result, shell scripts can be applied to many systems once they are "written attentively".
Therefore, the shell script is used because of the following features of the shell script:
Simplicity of:
The shell is a high-level language through which you can express complex operations succinctly.
Portability:
With the functionality defined by POSIX, scripts can be executed on different systems without modification.
Easy to develop:
A powerful and 妤 script can be completed in a short period of time.
However, given the command restrictions and efficiency of shell scripts, the following situations do not typically use the shell:
-
resource-intensive tasks, especially when you need to consider efficiency (such as sorting, hashing, and so on). The
-
Needs to handle the mathematical operations of large tasks, especially floating-point operations, precision operations, or complex arithmetic operations, which are typically handled using C + + or FORTRAN.
-
has cross-platform (operating system) porting requirements (typically using C or Java).
-
Complex applications where structured programming must be used (requiring variable type checking, function prototypes, and so on).
-
is applied to critical tasks that affect the overall system.
-
is a highly demanding task for security, such as requiring a robust system to prevent intrusion, cracking, malicious destruction, and so on. The
-
Project consists of the various parts of a string that depend on it.
-
Requires large-scale file operations.
-
Requires support for multidimensional arrays.
-
Requires support for data structures, such as linked lists or numbers.
-
Requires the creation or manipulation of a graphical interface GUI.
-
Requires direct operating system hardware. The
-
Requires an I/O or socket interface. The
-
Needs to use the interface of the library or old code that is left behind.
-
Private, closed-source applications (the shell script puts the code in a text file, as the world can see it).
If your app fits any of the above, consider a more powerful language.
--perhaps Perl, Tcl, Python, Ruby
--or a higher-level compilation language, such as C + +, or Java.
Even so, you'll find that using the shell to prototype your application is also very useful in the development steps.
This article from "Big Plum" blog, declined reprint!
When to use shell scripts and when not to script