The following is a 1-2-day study of Shell learning notes
————————-I'm the separator —————————
Hardware to perform, operating between the kernel and the hardware.
The command parser.
Component elements of a shell script
System
Requirements Analysis:
1, SSH Public key copy, provide no password management.
2, batch synchronization hosts files to more than one host.
3. Batch modification of host name.
Realize:
First edit a Hosts file for synchronization to multiple
Objective
I believe a lot of people have had this experience, when modified a pile of bugs, to update the code to the server, at this point, the simplest way is to upload the project file all at once, this way feasible, but not to take. Why, you
Today's case is the decision to input to the user
#!/bin/sh # validint-validates integer input, allowing negative ints. function Validint {# Validate field. Then Test against Min value $ and/or # max value $ if they are supplied.
If They
Today is about deciding whether the date entered is correct, and using the function in the example 03 before us is code
#!/bin/sh # valid-date-Validates a date, taking into account leap year rules. Exceedsdaysinmonth () {Case $ (echo $1|tr '
Having recently been using the Linux operating system and being familiar with some simple commands, I'll introduce you to some of the less-known but very useful commands:
1.mtr command to view the direct network connection of a MTR running host and
For Linux array definitions, and build methods, see: Linux shell dynamically generate array series SEQ usage tips. My main point here is to efficiently generate the list string, as well as the array method.
One, the SEQ method produces:
For example, you might want to refer to the following implementation for a script that requires only sequential access to a resource, such as a disk file.
Copy Code code as follows:
#!/bin/bash
#
# File locking using Bash.
# ver 0.1.6
Copy Code code as follows:
#!/bin/bash
Send_thread_num=13
Tmp_fifofile= "/tmp/$$.fifo" # script runs the current process ID number as filename
Mkfifo "$tmp _fifofile" # Create a new random FIFO pipeline file
exec 6<> "$tmp _fifofile" #
Like the following text:ABCD 1234 FDS2011 5501023 832er 1231
The request is processed as follows:ABCD 1234 FDS2011 550total1:1023 Total2:832er 12end
Determine if the last line of text is preceded by the first column with Total1: The second column
Summary
SEO optimization of the first step is to let spider spiders often come to your site to patronize, the following Linux commands can let you know the spider crawling situation clearly. Below we analyze for Nginx server, log file
The Linux shell is much more powerful in programming than in Windows batching, whether in loops or operations. There is no comparison of data types. The following is a summary of how an individual operates on an array while in use.
1. Array
You can use the SCP command when you want to transfer files between two Linux hosts, without entering a password after establishing a trust relationship. Copy your local host user's SSH key file to the remote host user's ~/.ssh/authorized_keys file,
The Nova provides NUMA-related advanced features under the NFV scenario, which provides a script to view the NUMA-related information for compute nodes.
#!/bin/bash function Get_nr_processor () {grep ' ^processor '/proc/cpuinfo | wc-l}
In the operational dimension scenario, we often need to match the IP address with a regular expression on the server.
The shell, like other programming languages, can also use regular group captures, but you cannot capture groupings in the form of $
The real-time traffic of the NIC can be viewed through the Iptraf command, and the image is very intuitive.
I'm going to look at the network traffic on the test server today.
Copy Code code as follows:
[Root@localhost ~]# iptraf-d eth0
-
One, for loop1. Digital Segment Form
Copy Code code as follows:
For i in {1..10}
Todo
Echo $i
Done
2. Detailed list (character and number of items are not many)
Copy Code code as follows:
For File in 1 2 3
Determines whether a specified script is a syntax error, and if there is an error, prompts the user to type Q or Q to ignore the error and exit, and any other key can open the specified script via vim;#! /bin/bashScript_file= "./test.sh"Sh-n $script
Turn from:Shell Several methods for judging string inclusion relationshipsNow every time you analyze the site log, you need to determine whether Baidu Spider is a real spider, after nslookup need to determine if the result contains "Baidu" stringThe
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