tempad
ReadyGo!技术成就梦想 >>Shell教程 >> Linux程式设计-11.ShellScript(bash)--(12)函数function

Linux程式设计-11.ShellScript(bash)--(12)函数function

ReadyGo!技术成就梦想 网络搜索 efish 2008-2-24 2:50:04
name(){list;}
function的参数是PositionalParaments。


#!/bin/sh

functionfunc(){
echo$1
echo$2
return1
}

func"Hello""function"

局部变数可用local来宣告。

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

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

责任编辑: efish 参与评论 查找更多:
相关文章
Linux程式设计-11.ShellScript(bash)--(14)Bash内建… Linux程式设计-11.ShellScript(bash)--(14)Bash内建参数
Linux程式设计-11.ShellScript(bash)--(15)提示符号 Linux程式设计-11.ShellScript(bash)--(15)提示符号
Linux程式设计-11.ShellScript(bash)--(16)算术表述 Linux程式设计-11.ShellScript(bash)--(16)算术表述
Linux程式设计-11.ShellScript(bash)--(17)重导Redi… Linux程式设计-11.ShellScript(bash)--(17)重导Redirection
Linux程式设计-11.ShellScript(bash)--(18)语法 Linux程式设计-11.ShellScript(bash)--(18)语法
Shell递归程序设计-目录列表 Shell递归程序设计-目录列表
写shellscript时,要如何从terminal读入字元? 写shellscript时,要如何从terminal读入字元?
我要如何将csh的stdout与stderr导向到不同的地方呢? 我要如何将csh的stdout与stderr导向到不同的地方呢?
2秒记住本站域名

玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的ReadyGo.com.cn

分类导航
ReadyGo!技术成就梦想