List of popular Linux and Windows scripting languages

Source: Internet
Author: User
Tags perl script
Summary of popular Linux and Windows Script language lists: system administrators with script knowledge are significantly different from other system administrators. Script is an art created by system administrators. There are many options for system administrators to write scripts. each script language has its own unique syntax and advantages...
Summary of popular Linux and Windows Script language lists: system administrators with script knowledge are significantly different from other system administrators. Script is an art created by system administrators. There are many options for system administrators to write scripts. each script language has its own unique syntax and advantages. There are almost no similarities between scripting languages, but it is not as difficult to understand as an alien language. The scripting language can be used for both system management and Web development. System administrators with script knowledge are significantly different from other system administrators. Script is an art created by "system administrators. This art requires knowledge about the system itself, the syntax of system management commands, programming and algorithm, and at least one scripting language. There are many options for system administrators to write scripts. each script language has its own unique syntax and advantages. There are almost no similarities between scripting languages, but it is not as difficult to understand as an alien language. The scripting language can be used for both system management and Web development. There are few script languages based on the server and client. Most client scripting languages are used to display content in a browser and interact with users. Server scripting is usually used to manage systems or Web services. In this article, we will only focus on the scripting languages used for system management. Let's get started! Something you should know about the script: the www.2cto.com script can be executed as an independent command, or it can be called using a binary file in the script language under the terminal command line interface. If the script is executable, write the following special code at the beginning :#! /Path/of/the/cli such as bash #! /Bin/bash or perl #! /Usr/bin/perl '#! 'Indicates the program to be called to execute the script. Bash has the largest number of bash scripts in Linux and UNIX. As we have mentioned in many articles, bash is also the most popular. Basically, bash is a command-line shell with an interpreted function. It can be used for programming and meets most basic programming needs. You do not need to declare or know the type of the variable before using the variable. Its disadvantage is that bash is not available in other libraries. You can only use/bin/bash (or/bin/sh ). When you declare a variable, you do not need to use the $ symbol before, but you need to add $ in front to indicate that it is a "variable ". Bash is very easy to write. Linux, UNIX, and Windows with the cywin program installed have bash. If you are a system administrator without bash script programming, you 'd better start learning. This article lists many good reference books. The following is a simple bash script. Www.2cto.com #! /Bin/bash USER = $1 echo "Adding User $ USER in group users..."/usr/sbin/useradd-g users $ USER if [$? = 0]; then/usr/bin/passwd $ USER else echo "Sorry, User addition failed" fi Perl basically, Perl can be seen as a Turing on UNIX and Windows systems) complete programming language. Perl refers to the Practical Extraction and Report Language ). Perl is a general programming language. it was originally developed for text processing and is widely used in many scenarios, including system management, Web development, network programming, and even GUI development. It is easy to use and supports both process-oriented and object-oriented programming. Perl is modular and easy to call third-party modules. Although designed with the goal of a complete Turing programming language, Perl has been used as a system management script since its launch in 1993. Perl supports both compilation and interpretation, so Perl is safer than bash scripts. When an error occurs, the bash script is unknown. However, if any errors occur during the compilation before execution, Perl will refuse to start the execution. A small Perl script helps you understand the style of the Perl language. # The following content is a comment. This script creates an array containing 1000 random numbers. Each random number contains 16 digits: www.2cto.com #! /Usr/bin/perl my @ numbers; srand (time); for ($ I = 0; $ I <1000; $ I ++) {$ a = int 10000000000 * rand (); $ B = int 10000000000 * rand (); $ c = $. $ B; push @ numbers, substr ($ c, 0, 16 ). "\ n";} print @ numbers; PHP everyone knows that PHP is generally used for Web site development, but it can also execute system management tasks like Perl. This is why many system administrators use PHP to complete cron tasks and other scripts. Although similar to Perl, PHP aims to generate standard HTML output. It is usually embedded in a Web server program to run. PHP of the command line version supports script programming. Similar to the preceding Perl example, the PHP script with the same function is as follows :#! /Usr/bin/php function make_seed () {list ($ usec, $ sec) = explode ('', microtime (); return (float) $ sec + (float) $ usec * 100000);} www.2cto.com srand (make_seed (); for ($ I = 0; $ I <1000; $ I ++) {$ a = rand (000000000,9999999999); $ B = rand (000000000,9999999999); $ c = $. $ B; $ numbers [] = substr ($ c, 1000) ;}for ($ I = 0; $ I <; $ I ++) echo "$ numbers [$ I] \ n"; Python is obvious. we are discussing scripting languages rather than some animal in the Amazon jungle. Python is a general high-level programming language that emphasizes code readability. Python syntax is very concise and expressive. Similar to Perl, Python also has many extension libraries. Although Python is capable of functional programming, it is most often seen as an object-oriented language. For Web development, Python is used to develop the mod_wsgi module of the Apache project. Today, most Linux and UNIX distributions contain Python, which is used as a scripting language for development by many system tools. Python also supports writing code for the GUI environment. The following is a simple python code: www.2cto.com health = 10 trolls = 0 damage = 3 while health> 0 :#! = 0: trolls + = 1 healthhealth = health-damage print "\" but takes ", damage," damage points. \ n "print" ", trolls," trolls. "sed is a Unix text parsing tool that provides a programming language for text parsing and conversion. Sed is short for Stream Editor. it is basically a text Editor that runs fast. Sed does not provide any interactive environment for file editing. It reads the content row by row, executes the sed script for the read content, and then outputs the execution result. You can use sed to quickly perform text operations on files. Perl has recently been used to handle the same job, but there are still some situations that require expert system administrators to use sed to quickly solve the task. The following is a simple example: www.2cto.com $ sed-e's/foo/bar/g' myfile.txt command will find all foo in the myfile.txt file, replace it with bar, and then output the result to the screen. The main command of sed IS's/foo/bar/g'. This command is also supported in vi or vim interactive editing mode. In addition to the content described in this article, there are many other scripting languages such as Ruby, VBScript, Java Script, JScript, Tcl, AppleScript, and Falcon. This article aims to introduce the scripting languages that are commonly used in system management and hope that you can familiarize yourself with them and improve your productivity.
ISystemAdmin http://isystemadmin.com/list-of-popular-scripting-languages-for-linux-and-windows
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.