首页 > 系统服务 > 详细

(17)shell函数

时间:2017-10-13 22:59:44      阅读:221      评论:0      收藏:0      [点我收藏+]

Shell 函数

linux shell 可以用户定义函数,然后在shell脚本中可以随便调用。

shell中函数的定义格式如下:


[ function ] funname [()] { action; [return int;] }




#!/bin/bash
sum(){
  echo $(($1+$2))  
}

sum 5  6

 

 

 

(17)shell函数

原文:http://www.cnblogs.com/songyu1015/p/7663682.html

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