sehll中函数返回值范围
通过下面的例子可以测试出shell中函数return的返回值为0--255
#!/bin/bash
#find the max one of two numbers
PARAM_ERR=256
PARAM_EQU=0
max2 ()
{
if [ -z "$2" ]
then
return $PARAM_ERR
fi
if [ "$1" -eq "$2" ]
then
return $PARAM_EQU
fi
if [ "$1" -gt "$2" ]
then
return $1
else
return $2
fi
}
max2 98 88
return_val=$?
if [ "$return_val" -eq "$PARAM_ERR" ]
then
echo "Need parameter"
elif [ "$return_val" -eq "$PARAM_EQU" ]
then
echo "They are equal"
else
echo "The max number is $return_val"
fi
- 在linux中导入sql文件的方法分享(使用命令行转移mysql数据库)_MySQL 技术_龙盟编程网
- 如何应用PHP函数imagettftext处理图片_php编程_个人技术分享
- 查询反向链接中link和domain的区别_SEO优化_龙盟编程网
- sql 查询本年、本月、本日记录的语句,附SQL日期函数_Sql Server开发_龙盟编程网
- Android定时器实现的几种方式整理及removeCallbacks失效问题解决_Android开发_龙盟编程网
- 如何解决C语言,函数名与宏冲突_C/C++开发_龙盟编程网
- 在ASP.Net中应用Javascript_Javascript编程_龙盟编程网