1. For loop(1) Requirements: Can read, can change. Does not require to be able to write out completely without reference. Because embedded does not need to completely re-handwriting the shell, system administrator (server OPS, Application layer
[Email protected] wyb]#CatZhuijiu.SH #!/bin/bash#1, write a script execution, enter a name, generate a random number 01-the number between 99. #2, if the same name repeated input, the captured number is the result of the first crawl, #3, the number
There are three ways to run a Linux program:(1), so that the file has executable permissions to run the file directly.(2), directly invoke the command interpreter execution program (Linux Shell is an interpreted language).(3). execute file using
1. What is a shell?The shell is in the outer layer of the kernel, which is responsible for receiving commands entered by the user, interprets the commands as kernel can understand, then executes by kernel and returns the results back to the default
Variable:A variable is made up of letters, numbers, and _, and cannot begin with a numberLength cannot exceed 255 charactersIn bash, the default type of a variable is a string typeVariable classification:1, user-defined variables: only in the
I. SOURCES of grepTo find a string by using the EX Editor::/pattern/pwhere P is printed, the first line containing the string pattern is printed, if you need to print all lines that contain pattern, you can::/g/pattern/pWhen G appears in front of
Signal is a process communication mechanism in Linux system. We can use a specific signal to interrupt the process. Each signal is associated with an integer value.The KILL command can be used to send a signal to a process, while the trap command
As a regular script operators, can find a problem, many times we are in different scripts to repeat the same piece of code. For example, we are going to use regular expressions to determine the legality of IP address, if each time to write the
First in the slot ads: want to go into a folder to see the following files must have permission to execute this file folder.SedP prints the corresponding line 2p prints the second line.-N outputs only rows processed by the SED commandLook at the
1, single parenthesis and double parenthesisThe double parenthesis command allows advanced mathematical expressions to be put into a comparison. The format is as follows:((expression))In addition to the standard mathematical operators used by the
Shell
The shell is a command-line interpreter whose function is to interpret the command that executes the user, and the user enters a command that the shell interprets to execute, which is called Interactive (Interactive).
The shell
How to let awk use Shell variables under LinuxWhen we write shell scripts, we typically include other small programs or commands in the script, such as awk operations. For awk , we need to find some way to pass some values from the shell to the
Condition test1. Test condition tests or [] (test conditions are true false)
Example: string comparison#!/bin/bashRead dataTest "$data" = = "Hello" //note there are spaces on either side of the equal sign or [$data = = "Hello"] echo $?
Linux Nineth Day: (August 11) Linux shell script programmingA shell script is a text file that contains some commands or declarations and conforms to a certain formatFormat requirements Run shebang mechanism#!/bin/bashBash-n syntax errors in/path/to/
Recently do the computer room bandwidth detection. Recently wrote a shell script to ping the IP of the machine room in bulk, returning the failure rate and the average response time#!/bin/bashlog=$1.logecho-n "" > $logfor i in ' Cat $ do/bin/ping-s 1
Turn from:http://blog.csdn.net/dawnstar_hoo/article/details/4043887Table of Contents1. Introduction to SED2. Addressing3. SED command4. Options5. Meta Character Set6. Example7. Scripts1. Introduction to SEDSed is an online editor that processes a
1. See the script for details#!/bin/bash# declaring an array declare -a test#j=0#cat > test.file 2. Implementation results[[Email protected] ~]# sh a.sh 1 2 3 4 5one A-print all of the array elements12345another A-to-print all of the ARR Ay elements1
Array definition: The so-called array, is the same data type of elements in a certain order of the set, that is, the finite type of the same variable with a name command, that is, these variables are defined as a group, they do not have their own
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