Linux  Shell 脚本编程之函数

来源:互联网 发布:众筹行业数据报告 编辑:程序博客网 时间:2024/04/29 22:45


#!/bin/bash
#purpose:to test shell funtion
#date:2015-02-05
#author:lirongqiang
function sayHello(){
echo "my first function"
return 0;
}
sayHello;
result=$?;
echo $result;
if [ $result = 0 ];then
echo "function has been executed successfully"
else
echo "error"
fi
注意事项: $# 表示输入参数的个数. $0 表示文件名 $1表示输入的第一个参数.   $2表示第二个.
 
0 0
原创粉丝点击