Shell 函数

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

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


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




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

sum 5  6

 

 

 


posted on 2017-10-13 22:44  飘曳残生  阅读(87)  评论(0编辑  收藏  举报