shell 函数
来源:互联网 发布:游戏脚本制作软件 编辑:程序博客网 时间:2024/05/16 07:33
test.sh
add()
{
result=`expr $1 + $3`
echo "$result"
}
minus()
{
result=`expr $1 - $3`
echo "$result"
}
main()
{
case $2 in
"+")
add $@
;;
"-")
minus $@
;;
esac
}
main $@
运行结果:
root@May:~/test# ./test.sh 4 + 6
10
root@May:~/test# ./test.sh 4 - 6
-2
root@May:
- [shell]shell函数
- shell函数
- Shell 函数
- Shell 函数
- shell函数
- shell --函数
- shell 函数
- shell函数
- shell函数
- 【shell】函数
- shell 函数
- shell---函数
- Shell 函数
- shell函数
- shell 函数
- Shell 函数
- shell函数
- Shell 函数
- JBehave in Practice
- 已知值,查询该值在哪个表中
- 关于在ADS环境下使用libc库函数的一些疑问
- 学校与我们,论教育
- Web.config配置文件详解
- shell 函数
- 6款不错的jquery画图插件
- myeclipse javaweb开发环境配置详解
- How to install p2psim on ubuntu.10.10
- Array类常用方法
- 解决在创建销售订单时出现工厂日历CN等错误提示问题
- Thread.join()不好用的解决方法
- CToolBarCtrl详解
- Source Insight