Suppose there are variables var=http://www.hao.com/123.htm One, # Intercept, delete the left character, retain the right character. Echo ${var#*//}where Var is the variable name, # is the operator, *// deletes all characters from the
First, the grammarBreak: Used to jump out of a loop. Break N can jump out of a multilayer loopBreakBreak NContinue: Used to skip loops. Continue N can skip multi-layer loopsContinueContinue NIi. details and differences
Break forVar1inch 1 2 3 Do
There are many ways to intercept strings in the shell,${expression} A total of 9 ways to use. ${parameter:-word}${parameter:=word}${parameter:?word}${parameter:+word}The above 4 alternatives can be used for default values. ${#parameter}The length of
In a Linux environment, if you don't know bash, then you don't have to learn anything else. The core of Linux was the kernel, and our users had to interact with the kernel through something to manipulate Linux. This thing is the shell. The shell is
These two functions implement the overload of the function!!
1. Default parameters
From this above can be seen, if a function inside, not the necessary parameters, add the corresponding default value, you can complete the corresponding function.
The reason for using a static local variable is that it cannot be used externally, but its value is still retained after it has not been used. Although using global variables can achieve the same functionality, it often causes
The example of this article analyzes the usage of reference & in PHP. Share to everyone for your reference, specific as follows:
PHP references (that is, precede variables or functions, objects, etc. & symbols)//The most important thing is to
echo commandFunction: Display character (trailing line wrapping function)Syntax: Echo [-nee][string]Description: Echo will send the input string to standard output. The output string is separated by a white space character, and a newline number is
variables and environment variablesVar=value assigns a value to the variable, the output statement: $ echo $var or $ echo ${var}, remember that there is a space in the middleFor example: Name= "Coffee" age= "$echo" my name is : ${name}, The age is :
PHP's Isset () function is commonly used to detect whether a variable is setFormat: bool Isset (mixed var [, mixed Var [, ...])Function: Detect whether the variable is setreturn value:Returns FALSE if the variable does not existReturns FALSE if the
1. There are several ways to use the shell command in Python, and I think it is better to use the commands module:Import commandsA, B = commands.getstatusoutput ("Ls-al")A is the exit state (int type), and B is the output of the shell commandPython--
1. String judgment
STR1 = str2 When two strings have the same content, the length is true
STR1!= str2 is true when strings str1 and str2 are unequal
-N str1 True when the length of the string is greater than 0 (string not empty)
-Z str1 True when
LS Displays current directory contents
1 ls/(Display all directories and files under the root directory)
2 Ls-l/(displays all directories and files in the root directory in the form of a list)
3) command 2 is equivalent to LL/
Absolute path and
There are many ways to intercept strings in the shell,
${expression} A total of 9 ways to use.${parameter:-word}${parameter:=word}${parameter:?word}${parameter:+word}4 of the above can be used to replace the default values.${#parameter}The above
Copy Code code as follows:
$memcached = Array (//memcached multi-process analog multiple memcached server CN en for Memory server name
' CN ' =>array (' 192.168.254.144 ', 11211),
' En ' =>array (' 192.168.254.144 ', 11212)
);
Isset-detect whether the variable is setThe PHP isset () is used to detect whether one or more variables are set and returns TRUE if the detected variable exists, or FALSE.
Example:
The code is as follows
Copy Code
$var
A comparison of examples
Example one:
Copy Code code as follows:
$var 1 = 1;
function Test () {
unset ($GLOBALS [' var1 ']);
}
Test ();
echo $var 1;
?>
Because the $var1 was deleted, nothing was printed.
Case TWO:
The test command is very powerful, but it is difficult to satisfy its escape requirements and the difference between string and arithmetic comparisons.
Greater than
Less than
Equals
Not equal to
If ["$a"-gt "$b"]
Logical operationsthe logic and && logic of the IF condition is not supported in the Nginx configuration or | | Operation, and the nested syntax for if is not supported, the following error is reported: Nginx: [Emerg] Invalid condition.We can do
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.