首页 > 编程开发 > Shell > 正文  
Linux程式设计-11.Shell Script(bash)--(12)函数function
出自:http://www.openchess.org/noitatsko/programming/ 2002年02月06日 15:06
[ function ] name () { list; }
function的参数是Positional Paraments。


#!/bin/sh

function func() {
echo $1
echo $2
return 1
}

func "Hello" "function"

局部变数可用local来宣告。

函数可export,使用下一层的shell可以使用。

函数可递,没有递层数的限制。

】【http://www.trainlinux.com】【Close
『相关资料』
Linux程式设计-11.Shell Script(bash)--(13)Bash内建指令集 (2002-02-06 15:05)
Linux程式设计-11.Shell Script(bash)--(14)Bash内建参数 (2002-02-06 15:05)
Linux程式设计-11.Shell Script(bash)--(15)提示符号 (2002-02-05 15:04)
Linux程式设计-11.Shell Script(bash)--(16)算术表述 (2002-02-05 15:04)
Home 

诚恩Linux培训工作室