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 reason to use shell scripts is based on:
- Simplicity: The shell is a high-level language through which you can express complex operations succinctly.
- Portability: Using POSIX-defined features, 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 (e.g., sorting, hashing, etc.).
- Mathematical operations that need to handle large tasks, especially floating-point operations, precision operations, or complex arithmetic operations (which are typically handled using C + + or FORTRAN).
- There are cross-platform (operating system) porting requirements (typically using C or Java).
- Complex applications where structured programming must be used (requires variable type checking, function prototypes, etc.).
- For mission-critical applications that affect the overall system.
- Tasks that require a high level of security, such as requiring a robust system to prevent intrusion, cracking, malicious destruction, and so on.
- A project consists of various parts of a chain of dependencies.
- Large-scale file operations are required.
- Support for multidimensional arrays is required.
- Support for data structures, such as linked lists or numbers, is required.
- Graphical interface GUI needs to be generated or manipulated.
- Requires direct operating system hardware.
- I/O or socket interface required.
- Interfaces that require the use of libraries or legacy old code.
- Private, closed-source applications (shell scripts put 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.
When to use the shell