#!/bin/sh #函数要定义在使用之前 function lession(){ echo "this is a function" } lession function lession2(){ echo "this is lession2" echo "The first is $1" echo "The first is $2" } lession2 1 2 function lession3(){ echo "this is lession3" sum=0; let "sum=$1+$2" return $sum; } lession3 1 2 echo "1+2=$?" #注意,aix中好像不能用()
原文地址:http://my.oschina.net/7shell/blog/289923