Because the backstage input colleague, uploads the file the time, to file the same name, but different suffix name, because the file path is very deep, about 10 layers, each layer has dozens of files, so manually find a very troublesome, so write a
Use shell script to compute the Linux NIC traffic, the most critical point in the method:
Copy Code code as follows:
Ifconfig $eth _name | grep bytes | awk ' {print $} ' | Awk-f: ' {print $} '
The flow of input and output is
The first description of our configuration file, are similar format, if the intranet is 192.168.0.3, the extranet is 123.123.123.123, the configuration file is as follows:
$db [' salver '] [' hostname '] = ' 192.168.0.3:3306 ';$db [' salver '] ['
First, receive the fixed length of the parameter
Copy Code code as follows:
[Root@svn shell_example]# Cat params.sh
#!/bin/bash
#传参测试脚本
echo "My name is ' basename $ ' I ' called as $"
echo "My I-parameter is: $"
echo "My
There are many examples of shell script-reading text files on the web, but they don't tell the whole story, only half of it. For example, read a text line from a testfile file in the following format:
Copy Code code as follows:
$ VI
Today there is a server A to transfer all the Web site program to another server B up, but away from work time is only 1 hours, in order to work on time, simply wrote a shell script to monitor whether there is transmission, I first in the server a
Test the effect of prefetching, using the CPU to always view the effect. According to the experiment found that the prefetch address in the address before the use of the 10 lines around the code at the effect is better!
Copy Code code as
In the shell script, you find a problem with the case statement.This method of specifying lowercase letters [A-z] and uppercase letters [A-z] is no use.
The following conditions occur:
Copy Code code as follows:
[Root@station1 ~]#
The company server has been dying for the last two days because of the full memory usage. Really can't stand the old call room to help people to restart, specifically wrote a script to release the memory, of course, this server is not too important,
A note earlier, just recorded two lines of code, put out the words is also a low quality page, so set up in order to only be visible, tonight to add.
Remember when the scene should be submitted sitemap when Baidu old hint of the wrong URL, cause
Because I've been working on some JSON data formats recently, I finally found JQ this great tool after a search. JQ allows you to manipulate JSON directly under the command line, including slicing, filtering, converting, and so on.Let's use a few
The Asia Pacific Network information is recorded here, updated every day.
Http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
The following script will edit this text, output several major network segments of the domestic operators.
The test command in the shell is used to check whether a condition is valid, and it can be tested in three aspects, such as numeric value, character, and file.
Numerical test
Parameters
Description
-eq
is equal to
When writing a shell script, we need to use a variety of special symbols, through these special symbols can make us write code more concise and efficient, here to the summary:
1, {} curly braces:Usage One: Wildcard extensionEg:ls
Shell script:
#!/bin/sh # # # Convert file from GB2312 to UTF-8 # path= "$" unset opt if ["$" = "Force"]; Then opt= "-c-s" fi if [-Z "$path"]; Then echo "Nusage: $ n" elif [!-e "$path"]; Then echo "Nerror:destination: $path does not exist.n"
if [str1 = str2] When two strings have the same content, the length is trueif [str1! = str2] When string str1 and str2 are not equalIf [-N str1] is true when the length of the string is greater than 0 (string non-null)If [-Z str1] is true when the
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