#!/bin/bash eat[1]="泡面" eat[2]="粑粑" eat[3]="烩面" eat[4]="热干面" eat[5]="鸡蛋面" eat[6]="刀削面" eat[7]="肉丝面" index=0 while [ "${index}" -lt 3 ]; do check=$(( ${RANDOM} * ${index} / 32767 + 1 )) mycheck=0 if [ "${index}" -ge 1 ]; then for i in $(seq 1 ${index}) do if [ $[indexcon[${i}]] == ${chek} ]; then mycheck=1 fi done fi done原文链接:https://www.f2er.com/bash/390196.html