注意事项: $# 表示输入参数的个数. $0 表示文件名 $1 表示输入的第一个参数.
#!/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
Linux Shell 脚本编程之函数
最新推荐文章于 2022-02-12 17:57:46 发布