Linux Learning-Advanced shell scripting (a) function

Citation: Usually when you write a shell script, you'll find that there are many places that use the same code or the same functionality. If it's a small code, it doesn't matter. But if you use it more than once and it's the same code, I think

Shell Selection Statement

If statement 1) if ... else statementSyntax for the IF ... else statement:if [Expression]then if is true fiIf expression returns True,then, the statement is executed and no statement is executed if False is returned.Finally must end with FI to

Shell Learning Note II (variable)

is a weakly typed variable that does not need to specify its variable type when declaring it, and does not need to follow the "declare before use" and can be used whenever you want. A variable in which a local variable is in effect in a shell is not

Shell Script Task Scheduler cannot execute issue

Today a shell script is written, and direct execution is possible.But it's not done with a task plan.The script is as follows:#!/bin/bashtime=0504timea=05Mysqd-f-u root DTS Tangled up half a day, then changed to absolute path on it.The script is as

The seven-function application of Linux shell

What is a function?A function is a collection of commands, represented by a name, called a function name. The function name has the same naming convention as the variable.Once the function is defined, execute the name as if it were a bash command

Shell script for utility (not periodically updated)

1, the implementation of the Sourse directory part of the file (the file name is listed as a text list, text file name list), copied to another directory/opt/targe/#!/bin/bashcd/opt/source for file in ' cat/opt/source/list ';d ocp-r-n

Comparison of if condition strings in the shell

If condition judgment Comparison of Numbers-eq equals if [$a-eq 11]; Then commend Fi-GT Greater than -lt less than-ge greater than or equal to-lt less than or equal tostring comparison = = string comparison must have a space if [$a = ' yes ']

A detailed here document in the Shell

We know that the usual linux command line operation can be placed in the file, given the executable permission, you can change the file into a shell script. But if we interact with some programs, the shell script doesn't help us too much. such as

Shell function return string

The return value of the Shell function (return), which only supports integers#!/bin/shget_str () {return "string"}get_strecho $?The output is as follows:./test.sh:line 5:return:string:numeric Argument required255You can see that the return integer

Nginx combined with Shell statistics user's UV and IP summary

The company's new demand, suspected PV and IP ratio is not right, see if there is malicious east:Nginx Configuration:Log_format main "" $http _user_agent "" $http _x_cookie "" $request _time "" $upstream

shell--Mathematical Calculation

The assignment and operation in the shell is the string processing by default, here are some special methods of mathematical operation in the shell, which can be seen later, hehe1. Examples of error methodsAVar=1+1Echo $varThe result of the output

Some of the supernatural powers of ${} in the shell

Suppose we define a variable as:File=/dir1/dir2/dir3/my.file.txtWe can replace each other with ${} to get different values:${file#*/}: Take out the first/its left string: dir1/dir2/dir3/my.file.txt${file##*/}: Take out the last/and left string:

Ext: 10 Good programming ideas. (Source: Cool Shell –coolshell.cn)

There's a post on stack overflow, "What's your most controversial programming opinion?" translated into Chinese is " What do you think is the most controversial programming idea?" However, in more than 400 main huitie, as well as thousands of huitie,

Shell script that executes system commands and writes output to a log file

Presumably the requirement is that the AIX system Usysfault command takes the fault light information, but this command appears to be performed only by the root user, and the other user executes the error. All sorts of ways to empower all fail, so

Some of the supernatural powers of ${} in the shell

Suppose we define a variable as:File=/dir1/dir2/dir3/my.file.txtWe can use${ }Replace each to get different values:${file#*/}: Take out the first one./And the string to its left:Dir1/dir2/dir3/my.file.txt${file##*/}: Take the last one off./And the

Shell Script Monitors Server status

First, the installation of Mutt1 yum-y Install postfix2 #需要安装sendmail并开启防火墙的25端口, if you need to receive mail 110 port also open 3 yum-y install Mutt  Second, configuration informationAbout the configuration information, there is a point to explain,

The difference between printf and echo in a Linux shell

EchoEcho is a very common shell command. The parameters are as follows: -e: Turns on parsing of backslash character backslash-escaped, that is, parsing characters such as/n,/t, rather than two characters -E: Turn off parsing of

Shell command Tips--text to weight and maintain the original order

In short, this technique corresponds to one of the following scenariosSuppose there is text as followsccccaaaabbbbddddbbbbccccaaaaNow it needs to be re-processed, this is very simple, sort-u can be done, but if I want to keep the text in the

Summary of Shell Small issues

Summary of Shell Small issuesThis article source: http://blog.csdn.net/bluishglc/article/details/44276607 prohibited any form of reprint, or will entrust CSDN official maintenance rights! Summary of Shell Small issues If

Shell Custom Array element delimiter

Company personnel named image used to add a space, today there is a need, to bulk download this write pictures, this egg hurtThe correct URL is thisHttp://url 2119 01.jpgHttp://url 001.jpgWritten into the text will be added to escape,

Total Pages: 541 1 .... 136 137 138 139 140 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.