When to use shell scripts and when not to script

Source: Internet
Author: User
Tags posix

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.