首页 > 其他 > 详细

函数的用法

时间:2015-02-01 17:22:10      阅读:303      评论:0      收藏:0      [点我收藏+]

函数功能的使用
[root@teacher lianxi]# vim function.sh
[root@teacher lianxi]# chmod +x function.sh
[root@teacher lianxi]# ./function.sh
please key in first num
10
please key in second num
23
num1 + num2 equal 33
[root@teacher lianxi]# cat function.sh
sum() #定义函数的名称
{
echo "please key in first num"
read num1
echo "please key in second num"
read num2
let num3=$num1+$num2
echo -e "\033[31m $num1 + $num2 equal $num3 \033[0m"

}
sum #调用函数,执行这个函数

函数的用法

原文:http://www.cnblogs.com/blog-acf/p/4265669.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!