1. Gets the return value of the Shell function call:#!/bin/sh info () { cat jlb.sh} res= ' info ' echo ' state: ' $?echo ' res: ' ${res}description : res='info' This behavior calls function info, inside the symbol ' is not a single argument, but the ESC key below the one. Another $? Returns the run state of the previous command, not the return value.2, get
1. Gets the return value of the Shell function call:#!/bin/sh info () { cat jlb.sh} res= ' info ' echo ' state: ' $?echo ' res: ' ${res}description : res='info' This behavior calls function info, which conforms to ' not single quotes, but the one below the ESC key, plus $? Returns the execution state of the previous command, is not a return value;2, get the
function allows us to divide a complex function into several modules, which makes the program structure clearer and the code reuse more efficient. Like other programming languages, the Shell supports functions as well. The Shell function must be defined before use.The Shell functions are defined in the following format:Function_name () { List of commands [r
line:
Copy Code code as follows:
[Root@ufo shellprogram]#./testexecutelog.sh 0 Msglog Execlog
In the above shell script, num1 corresponds to a value of 0 logfile in the command line with a value of Msglog execlogfile execlog.
The use of function setlogfile is setlogfile log file name, in the example using SetLogFile ${execlogfile}, in t
First, define the shell function (define functions)
Grammar:
[Function] funname [()]{Action[Return int;]}
Description
1, can be defined with function fun () or directly fun (), without any parameters.2, the parameter returns, may display adds: Return returns, if does not add, will run the result with the last command, as the return value. return followed by value
Problem Description: In the local virtual machine Linux environment, Redis is installed and operated using the shell. I have stored in Redis the value of STR is Chinese "we", but when I get the value of str under the shell get to is: \xe6\x88\x91\xe4\xbb\xac.Workaround: Just want you to start redis-cli when you add the
function allows us to divide a complex function into several modules, which makes the program structure clearer and the code reuse more efficient. Like other programming languages, the Shell supports functions as well. The Shell function must be defined before use.The Shell functions are defined in the following format:Function_name () { List of commands [r
The Shell function returns the value, generally has 3 kinds of ways: Return,argv,echo
1) Return statementThe return value of the Shell function, as in other languages, can be returned through the return statement.Example:
#!/bin/bash-
function mytest ()
{
echo "arg1 = $"
If [$ = 1]; then return
1
els
The Linux shell can be user-defined, and can be invoked randomly in a shell script. Here's how it's defined, and what the call needs to pay attention to.
First, define the shell function (define functions)
Grammar:
[Function] funname [()]
{
Action
[Return int;]
}
Description
1, can be defined with function fun () or directly fun (
1. When the shell script executes the Python script, you need to use the return value of the Python script to determine the command to be executed by the following program
Example: There are two py programs hello.py
Copy Code code as follows:
def main ():
Print "Hello"
If __name__== ' __main__ ':Main ()world.py
def main ():Print "Hello"
If __name__== ' __main__ ':Main ()
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 function
Grammar:
Copy Code code as follows:
[Function] funname [()]
{
Action
[Return int;]
}
Description
(1) can be defined with function fun () or directly fun (), without
AWK offers the most powerful features:
Can be matched for regular expressions
Style mount
Flow control
Mathematical operators
Process Control Statements
Built-in variables and functions
You can think of awk as a complete programming language, and it's incredibly fast to handle text. Now a lot of shell log analysis tools can be used to accomplish this. The design is simple and the speed is very good. Related to the above six a
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 () definition, you can also directly
Original works, allow reprint, please be sure to use hyperlinks in the form of the original source of the article, author information and this statement. Otherwise, the legal liability will be investigated. http://nbmonster.blog.51cto.com/1977736/665767Several cases of sqlplus and shell passing value to each otherScenario One: The simplest invocation of sqlplus in the s
Shell function return value, generally in three ways: return, argv, Echo
1) Return StatementThe Return Value of the shell function, which can be the same as that of other languages, returned through the return statement.Example:
#!/bin/bash -function mytest(){ echo "arg1 = $1" if [ $1 = "1" ] ;then return
Ext.: http://blog.csdn.net/ithomer/article/details/7954577Shell function return value, generally there are 3 ways: Return,argv,echo1) Return statementThe return value of the Shell function, which can be returned by a return statement, as the return value of other languages.Example:[JavaScript]View PlainCopyprint?
#
): "" Executes the shell command in a non-blocking manner (the default for Popen). "' Self.logger.debug (" Run%s "%self.cmd) # Popen throws a OSError exception when the command to execute does not exist, but after Shell=true, the # Shell handles the command does not exist Error, so there is no oserror exception, so we do not have to deal with self._process = subp
The function return value in Shell exceeds the limit.
This article mainly introduces the function return value in Shell that exceeds the limit. In shell, return is restricted. If the return value exceeds 255, the return
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.