One - One Code All

Blog Content

linux运行脚本函数

Linux-Mac   2008-10-11 22:20:24

1、同一脚本文件中的函数:

#!/bin/sh
function func1()
{
echo $1
}
func1 "Hello world!"


2、其它脚本文件中的函数:
func.sh文件内容如下(其中定义了函数func1,需要1个参数):

#!/bin/sh
function func1()
{
echo $1
}


主程序脚本:

#!/bin/sh
. func.sh
func1 "Hello world!"



上一篇:linux本地文件夹挂载
下一篇:shell脚本中获取当前的年月日时分秒

The minute you think of giving up, think of the reason why you held on so long.