#!/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中好像不能用()
shell中函数定义及使用
时间: 2024-12-11 05:01:23