langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
10
Task/Function-definition/UNIX-Shell/function-definition-1.sh
Normal file
10
Task/Function-definition/UNIX-Shell/function-definition-1.sh
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
multiply() {
|
||||
# There is never anything between the parentheses after the function name
|
||||
# Arguments are obtained using the positional parameters $1, and $2
|
||||
# The return is given as a parameter to the return command
|
||||
return `expr "$1" \* "$2"` # The backslash is required to suppress interpolation
|
||||
}
|
||||
|
||||
# Call the function
|
||||
multiply 3 4 # The function is invoked in statement context
|
||||
echo $? # The dollarhook special variable gives the return value
|
||||
Loading…
Add table
Add a link
Reference in a new issue