1 , theorem contentDedekind cutting theorem: Set is a cut of the real number set, or there is a maximum number, or there is a minimum number.Definite definition: The number set of the upper bound must have an upper bound, and the number set of the lower bound must have a definite boundary.2. Certification processSet of non-null sets has upper boundRemember, that
The shell is much more programmatic in terms of programming than Windows batch processing, both in loops and operations.Bash supports one-dimensional arrays (which do not support multidimensional arrays) and does not limit the size of arrays. Similar to the C language, the subscript of an array element is numbered starting with 0. Gets the elements in the array to take advantage of subscript, the subscript can be an integer or an arithmetic expression
as defining a new command, which is a command, so that each input parameter is separated directly by a space. Once, the command to get the parameters of the method can be passed: $ ... $n get. The $ $ represents the function itself.
3, function return value, only through $? The system variable is obtained, the direct pass =, the obtained is the null value. In fact, we follow the above understanding, know that the function is a command, in the shell
Myurl="http://see.xidian.edu.cn/cpp/shell/"
ReadOnly Myurl
Myurl="http://see.xidian.edu.cn/cpp/danpianji/"
Run the script with the following results:/bin/sh:name:this variable is read only.Delete a variableUse the unset command to delete a variable . Grammar:
Unset variable_name
The variable cannot be used again after it has been deleted; The unset command cannot delete a read-only variable.As an example:
The shell is much more programmatic in terms of programming than Windows batch processing, both in loops and operations.Bash supports one-dimensional arrays (which do not support multidimensional arrays) and does not limit the size of arrays. Similar to the C language, the subscript of an array element is numbered starting with 0. Gets the elements in the array to take advantage of subscript, the subscript can be an integer or an arithmetic expression
The shell is much more programmatic in terms of programming than Windows batch processing, both in loops and operations.Bash supports one-dimensional arrays (which do not support multidimensional arrays) and does not limit the size of arrays. Similar to the C language, the subscript of an array element is numbered starting with 0. Gets the elements in the array to take advantage of subscript, the subscript can be an integer or an arithmetic expression
:
1, the definition function can be the same as the system command, the Shell Search command, first of all in the current shell file defined in place to find, find direct execution.
2, need to obtain function value: through $?
3. If you need to spread other types of function values, you can define the variable (this is the global variable) before the
valuereturn 0 returns without error.Return 1-255 has error returned3. Define and use functions in scriptsfunction definition:Functions must be defined before they are used, so the function definition should be placed in the beginning of the script,Until the shell finds it for the first time before it can be usedThe calling function uses only its name of functions.Example:$cat func1#!/bin/bash# func1Hello (
http://www.jb51.net/article/33899.htmLinux shell custom functions (definition, return value, variable scope) IntroductionThe Linux shell can be user-defined functions and can be called casually in shell scripts. Here's how to define it, and what to call attention to.I. Defining she
The Linux shell can be user-defined functions and can be called casually in shell scripts. Here's how to define it, and what to call attention to.I. Defining shell functions (define function)Grammar:
[Function] funname [()]
{
Action
[Return int;]
}
Description
1, can be with function fun ()
]} 5[[emailprotected] ~]# set -- "I am" shuyun yunwei.[[emailprotected] ~]# for i in "$*";do echo $i;doneI am shuyun yunwei.[[emailprotected] ~]# for i in "$#";do echo $i;done 3[[emailprotected] ~]# for i in "[emailprotected]";do echo $i;done I amshuyunyunwei.* * Print individual parameter information * * * * * * *[[emailprotected] ~]# for i in "$1";do echo $i;doneI am[[emailprotected] ~]# for i in "$2";do echo $i;done shuyun[[emailprotected] ~]# for i in "$3";do echo $i;done yunwei.* * * withou
I. Function definition Grammar: [function] functionname[()]{action; [return int;]} Description 1, can be with function fun () definition, you can also directly fun () definition, without any parameters. 2, the parameter returns, can display add: return returns, if not added, will run the result as the last command, as the return value. Return followed by a value
1. The Function Definition Format in shell is:
Function name (){
# Function body
}
The function definition must follow the principle first defined in use, such as defining the function print
#!/bin/shfunction print(){if [ $# -lt 1 ]then print “no parameter”;return 1;else ehco “$1,$2”;return 0;fi}ehco “print function is being invoked”print
The return statement
Tags: Shell function definition, execution, parameter shell recursive function shellforkxxxFifth. Definition, execution, parameters and recursive functions of shell functionsBash (Bourne Again Shell) also supports functions, when
Description of function definition formats, function parameters, and Shell functions
You can use shell to define a function, and then use it in a shell script. The Function Definition Format in shell is as follows:
[ function ] fu
shell supports custom variables.Defining variablesWhen defining a variable, the variable name does not have a dollar sign ($), such as:The code is as follows: Variablename= "value"Note that there can be no spaces between the variable name and the equals sign, which may be different from any programming language you are familiar with. At the same time, the name of the variable names must follow the following rules:• The first character must be a lette
function definition Format:[function][()]{ action; [returnint;] }Cases:#!/bin/bash Funwithreturn () { Span class= "PLN" > echo echo "Enter first number : " read anum echo " Enter a second number: " read anothernum echo " two numbers are $aNum and $anotherNum, respectively! " return $ (( $aNum + $anotherNum } funwithreturnecho The sum of the two numbers entered is $?! " Output: This function adds two numbers to the input
The Linux shell can be user-defined functions and can be called casually in shell scripts. Here's how to define it, and what to call attention to. I. Defining shell functions (define function)Grammar:
[Function] funname [()]
{
Action
[Return int;]
}
Description
1, can be with function fun ()
obtained through the system variable, directly through =, get is a null value. In fact, we follow the above understanding that the function is a command, in the shell to obtain the command return value, all need to get through the $?
function scope, variable action rangeExample (test_fun2.sh): #!/bin/shecho $(uname);declare num=1000;uname(){ echo "test!"; ((num++)); return 100;}testvar(){ local num=10; ((num++)); echo $num;}un
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.