linux shell script 函式

来源:互联网 发布:比价软件淘宝小密 编辑:程序博客网 时间:2024/06/05 20:29

1.简单的shell函式

先建立一个简单的shell函式,如下:

查看运行结果:

g

2.查看、移除函式

利用declare命令查看刚刚建立的dir_f函式。

declare -f dir_f

利用unset命令移除刚刚建立的dir_f函式。

uset -f dir_f

3.函式语法

由上面的简单例子可以看出,shell function的基本语法是:

name ( )

{

statement

}

 


<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击