#!/bin/sh testArr[1]="echo 1" choose=`expr $RANDOM % 5` choose=`expr ${choose} + 1` #then do the test by the random choose ${testArr[${choose}]}; ~ ~ 转载于:https://www.cnblogs.com/kikilbs/archive/2009/07/27/1532210.html