1. 程式人生 > >(17)shell函數

(17)shell函數

class blog tty span () function 用戶定義函數 clas logs

Shell 函數

linux shell 可以用戶定義函數,然後在shell腳本中可以隨便調用。

shell中函數的定義格式如下:


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




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

sum 5  6

(17)shell函數