在 bash 中我们可以写函数,但实际上我们有两种方式(两种语法),
请指教
example1 和 example2 有什么区别
或者也许没有任何区别?
function I_love_function
{
.
.
}
I_love_function ()
{
.
.
}
如何调用函数I_love_function
最佳答案
发件人:http://www.gnu.org/software/bash/manual/bashref.html#Shell-Functions
Functions are declared using this syntax:
name () compound-command [ redirections ]
or
function name [()] compound-command [ redirections ]
This defines a shell function named name. The reserved word function is optional. If the function reserved word is supplied, the parentheses are optional.
关于linux - bash - 编写函数语法的两种方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23994072/