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
I am also a novice, write a bit old-fashioned, right when practicing, for beginners friends reference it.
Copy Code code as follows:
#!/bin/bash
If [$SUCC _ping-gt $ ((ping_count-1))];then
If [F./alarm_file/alarm_$host];then
My configuration is the Linux, android4.2.2 SDK. The implementation details are in the code comments, and the variable name and echo content are part of the description.
The main process is:
1. The simulator that detects whether the port is
Description: The subscript for an array in the shell defaults to the 0 start
1, put the string in the array, get its length
Copy Code code as follows:
#!/bin/bash
Str= "A B--n D"
Array= ($STR)
length=${#array [@]}
Echo
Copy Code code as follows:
#!/bin/sh
# Desc:setup Linux system security
# AUTHOR:CORALZD
# Powered by www.freebsdsystem.org
# version 0.1.2 written by 2011.05.03
#account Setup
Passwd-l XFS
Passwd-l News
Passwd-l NSCD
Passwd-l Dbus
=================================================
This article for Khler original, reprint must ensure that this article complete and completely retain the original author information and this article original
Often see commands like the following in blogs or forums the curly braces extend brace expansion {} Shell functions
Cp/etc/httpd/httpd. {,. Bakup}
Or is
MV Resume{z,}.doc
So what does it mean in the uinx/linux shell
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 $
1. Preface
Almost six months did not write a blog, deserted for a long time, the work of the chores too much, their own more and more lazy. In order to spur their own growth, or adhere to write a blog, record their growth.
2. Introduction to Shell
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
-
To ensure that the PHP page runs in the background, write a monitoring script, assuming that the program exits unexpectedly, you can automatically restart.
Shell Script/usr/local/scripts/receve.sh content:
#!/bin/bash
#funtion: Keep
The most recent script always needs to be computed, and every time awk is cumbersome, it encapsulates the subtraction of awk, and each time the direct source math.sh is invoked.There are some points to be pointed out so as not to forget in future
If you want to add a character after a variable, you can use the method:
Copy Code code as follows:
$value 1=home
$value 2=${value1} "="
Echo $value 2
Add the string variable you want to add {}, and you need to put $ outside.The
1. The problem addressed
When you need to enter many commands at once, for example, to remove files from multiple directories at once
Copy Code code as follows:
CD Dir1
RM file1.temp
Cd.. /.. /dir2
RM-RF Dir3
When you
Demand
I wrote this script two days ago when I met the need to extract a file in a 10-story folder.
A file structure like the following:
Copy Code code as follows:
Dir1
├──a
│├──b
││└──file1
│└──file2
├──c
│└──d
│├──e
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