The waste CPU opens the shell to open the process.
1. Preparation work
2, this step with a knife when you must be careful to be patient, do not scratch the CPU cover and the following section, do not be afraid of no place to row, the CPU
1.Follow"File Type"to Judge(presence or not)- e:does the "file" exist? exist as true(Common)-F:is the "file" aNormalfile(file)? (Common)- D:whether the "file" is a directoryfile(directory)? (Common)- b:whether the "file" is ablock device files
IDC small rookie one, non-trained. There are often customers with CentOS servers that need to allocate 15 IPs or even 30 IPs. Each time a manual assignment was cumbersome, it took a day to learn the shell script and write the
In Linux, if the file name is enclosed in parentheses, the parentheses should be processed first, preceded by "\" before "(" and ")". Bracket_handle gives the processing method:Sub Bracket_handle {My ($tmp _name) = @_;$tmp _name =~ s/\ (/\\\ (/g; # (
The case statement and the judgment statement [If...elif...else] function similarly;When logic is relatively simple, the code is much less than the latter.Case usage, use a variable to match a value, if the match succeeds, execute the command below
Note: ". "There are spaces around the dot number.1. Find-name "*.txt"Find the file that ends with txt in the current directory (and subdirectory).2. Find-name "[a-z]*"Find the file that starts with all letters under the current directory (and
Regular expressionsJob One: organize regular expression BlogsRegular expressionsA regular expression is the rule of a string of characters in a class word.GrepThe grep command is useful in situations where a pattern-based search is performed on the
Automated deployment and monitoring of development scripts1. Scripting automatic deployment of reverse proxy, web, NFS;Requirements: I, the deployment of Nginx reverse proxy three Web services, scheduling algorithm using weighted polling;II, all Web
Shell Basics (i)* represents 0 or more arbitrary characters? represents an arbitrary character# Comment symbol, comment description meaning, that is, the content behind the # Linux ignored, or in the shell script to explain the symbol, explain the
Job One: organize regular expression BlogsHave finished finishing.Job Two: grep jobs (regular expressions and character processing)Target file/etc/passwd, using the grep command or Egrep1. All rows containing root are displayed:[[email protected] ~]#
Collect a simple shell learning document:Link:http://c.biancheng.net/cpp/view/6994.htmlThe shell itself is a program written in C, which is a bridge for users to use Unix/linux, and most of their work is done through the shell. The shell is both a
Encountered a remember a1, omit sudoUsing the Su-i command after landing with the primary user will log in as root in the shell, then the command will not need to add sudo and password. Another user has tried, Su does not have the-i option. Online
1.Linux default shell is bash,unix default shell is shBash is fully compatible with SH2. Define variables:When defining a variable, the variable name does not have a dollar sign ($), and a variable is used before the variable name plus $There can be
# # # #shell脚本基础 #####1. Basic ConceptsPurpose: Many instructions are assembled together, circulated, judgedformat: Name . SH (with color)operating Environment : #! /bin/bashRun File: 1>chmod +x file Direct plus absolute address to make file
Delete
${varname#strmatch}//Match the Strmatch from scratch in varname and then remove the position from the beginning to the first match
${varname# #strMatch}//Match the Strmatch from scratch in varname and then delete the position
# Abc=haha# echo $ABChaha# echo "$abc"haha# echo ' $abc '$abc# echo ' $abc 'haha# echo ' $abc ' $ABC 'Haha$abcFrom the above example, it is not difficult to see that the double quotation marks are not shielded from the variable and some special
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.