#!/bin/bash# name:enerpres shell first chapters.# time:2019/3/30# author:yeng# compary:XXXXX集团有限公司PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATHtest(){if [ \"$#\" -ne 2 ];thenecho \'你输入的变量数量不对。。\'return 1elseaccept=\"$@\"accepts=`echo $accept|awk \'{print $2}\'`expr 1 + $accepts &>/dev/nullif [ \"$?\" -ne 0 ];thenecho \"你输入的第二个值不是数字.\"return 1elseecho \"$@\"fifi}main(){test $1 $2if [ $? -eq 1 ];thenexit 1fi}main $1 $2
shell 经典传值案例
未经允许不得转载:爱站程序员基地 » shell 经典传值案例