For loopUsage:forindo 循环体doneSo how do you build the list?{1..100}This will generate the list.===========================================Cases:#!/bin/bash#forin {1..100};do echo$IdoneSeqYou can also generate lists with the SEQ commandUsage:seq
Using the WC command to count the file lines, the number of words, the number of characters, using sort sorting and de-weight, combined with uniq can be the word frequency statistics.Cat File.txtsort hello.c | uniq-c | Sort-nr |head-5Use cat
Problem Description:In the high-traffic line service, the log system will produce a large number of logs, at all levels of the tens of millions of G. A quick search of logs in such a large file is a problem that ops people often encounter. The
The content of this section:Shell string Interception method1, remove the leftmost character of the string[[Email protected] ~]$ VI test.sh1Str="ABCD" 2str=${str#"a"} 3Echo $STR4str=${str%"D"}
Cat/dev/null > FileName Empty file information Trash, the data sent to the secondary file will be deleted. W.H.O. | Wc-l calculating the number of users | (pipeline) can be two more programs between the establishment of a pipeline pipe:who output
write a script to generate a random 3-bit number, and can be based on the user's input parameters to determine the output of a few groups. For example, the script name is number3.sh. Execution Method:Bash 2.shproduces a set of 3-digit numbers
The common options directory is present without an error (at this time there is no effect on the directory), there is the creation of mkdir-p, if there is a need to create a parent directory when creating a directory when the parent directory is
1, in order to facilitate the query server hardware information, will need to query the content into the shell footsteps, output their desired format. In fact, it is through the dmidecode command output, and then through the sed,awk,cut command
Shell Process Control (if structure loop structure branch structure)Controlling the execution of scriptsProcess control can be nested with each other, or they can nest themselvesJudging result execution according to condition condition---------------
Since setting up a LNMP environment uses a step-by-step approach to installation is clumsy, the installation steps are written into a simple shell script, and most of the requirements can be achievedSuitable system version: centos6.5-6.7
Shell Process ControlUnlike Java, PHP and other languages, SH's process control is not empty, such as (the following is the PHP Process Control notation):phpif(isset($_get["Q"])){ search(q);} else{//Don't do anything } You can't write
Most UNIX system commands accept input from your terminal and send the resulting output back to?? to your terminal. commands usually read input from the standard input, which is the default terminal . Standard output, which is the terminal by
The Shell, like other programming languages, supports a variety of operators, including:
Arithmetic operators
Relational operators
Boolean operator
String operators
File Test Operators
Native Bash does not support
This script is not a complete script, has not implemented automatic mount partition, each disk is divided into 2, 1 partition for the 1g,2 partition of 2G.#!/bin/bashCount= ' fdisk-l|grep/dev/sd.*|grep-v '/dev/sda.* ' |wc-l 'I=1While [$i-le
In Linux systems, regular expressions (regularexpression) are powerful tools for finding, replacing, deleting, and so on for every Linux user, through the arrangement of special characters.In existing systems, regular expressions are also divided
Write a script:1) display a menu to the user:d| D) show disk usages.m| M) show memory usages.s| S) show swap usages.QUIT|Q) quit.2) Display the appropriate content when the user is given an optionWhen the user chooses to complete, displays the
First, the logical operator
Logical Volume Label
Express meaning
1.
About the file and directory of the detection of Logical volume label!
-F
Common! Detect if "Archive" exists eg:if [-f
First, what is the bean Shell
BeanShell is a scripting language that conforms fully to the Java syntax specification and has its own syntax and methods.
BeanShell is a loosely typed scripting language (this is similar to JS);
Previous JMeter Bean shell Use (a) a brief introduction of the bean shell in the next jmeter, this article is a supplement to the above, mainly summarizes the common scenarios and methods, I believe these basic can cover most of the needs. This
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