Objective
How did grep get out?It's going to take us discovering, "g/re/p" see, that's it. "Global Regular expression print" ==> "globally finds the regular expression (RE) and prints the resulting row. ”The grep family consists of commands
#!/bin/bashcd= ' df-l |awk ' nr==3 {print $4} ' |awk ' BEGIN {fieldwidths= ' 2 1 "} ' {print '} 'If [$CD-ge 20];thenecho " hard disk space is full and cannot be backed up " | Mutt-s " backup alarm, please replace the hard drive in time " [Email
For C in a B C D E F g;do echo $c; Done sequentially outputFor C in a B C D E F g;do tar czvf install.log. $c. tar.gz Install.log; DoneFor C in {a.. g}; do echo $c; Done the same as aboveSeq 1 10 columns of numbersFor i in {1..10}; do echo $i;
Write a script that calculates all the odd and all the even numbers within 100 and displays them separately#! /bin/bashSum1=0For i in ' SEQ 1 2 100 'Dosum1=$[$sum 1+ $i]Doneecho $sum 1Sum2=0For j in ' SEQ 2 2 100 'Dosum2=$[$sum $j]DoneEcho $sum
1:declare commandshell Default is String typeIf subtraction is required, it needs to be defined as an integral typeDECLARE command: Change the default variable type Decalre [+/-] [option] Variable name-set type properties for variables+ Cancel
The shell practice of Linux Learning
1. Describe the operation principle of shell program (can be attached with necessary graphic instructions);2, summarize all the knowledge points involved in shell programming (such as: variables, grammar,
Shell Common Command Summary1 ls command: List filesLs-la list all files and folders in the current directoryLS A * lists all files starting with the A letter in the current directory Ls-l *.txt Lists all files with the suffix txt in the current
When the shell executes a command, it returns a return value that is saved in the shell variable $? In When $? = = 0 o'clock, indicating successful execution; = = 1 o'clock, which indicates that the execution failed. www.2cto.com Sometimes the
Shell Introductionbash programming, then start with the programming, What is the program first? Personal words Explanation: program is the process of processing data. So, The program design consists of : program = data structure +
Because I usually write some small experimental script, every time to write author,description and so very troublesome, then wrote such a script can create their own small script, code as follows, pure personal original, relatively rough, big God
Shell Introduction
The shell is a programming language interpreter, which interprets commands entered from the keyboard, and also explains the sequence of commands stored in the script, which is a file containing a series of commands, and
List The 10 shells you use mostHistory | awk ' {a[$2]++}end{for (i in a) {print a[i] "i}} ' | Sort-rn | HeadHistory | awk ' {a[$4]++}end{for (i in a) {print a[$i] " " i}} ' | sort-rn | headgrep-v "#". Bash_history |awk ' {++a[$1]}end{for
character
meaning
*
Match 0 or more characters
?
Match any one character
[list]
Match any single character in the list
[!list]
Matches a character other
1. Describe the operation principle of shell program (can be attached with necessary graphic instructions);
Span style= " font-size:12px;">shell is a special program that is officially defined as the interface to the kernel and is
Requirement Description: The string in the document is counted and sorted (from large to small), the test.txt content of the first 2 records is displayed as follows: A 12332a 2323a 234234b 232c 23432c 34 statistics and Sorting methods:
First, an array overviewArrays: Data StructuresData series, continuous multiple data, can be used to get related elements of the indexDeclaring an array:declare-e arraynameInitialization assignment:arrayname= ("STRING1" "STRING2" ... )Arrayname=
Multi-thread Linux Shell script and linuxshell
In bash, we run (&) in the background to implement multithreading.
for((i=1;i
We have added {} & so that the execution in {} can be performed in the background. The above is equivalent to executing
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