#!/bin/bash #Usage:rand num #产生顺序字符的函数,可参考: # #略加修改即可 ^_^ #此处设定的是50位以内的,过多的话,或许有问题 # [[ $# != 1 || $1 > 50 ]]&&{ echo "Usage ${0##/*} num";exit 1; } array=(a b c d e f g h i j k l m n o p q r s t u v \ w x y z A B C D E F G H I J K L M N O P Q R S T U V\ W X Y Z 0 1 2 3 4 5 6 7 8 9) dodo(){ echo -n ${array[$((RANDOM%${#array[@]}))]} } i=1 n=$1 while((i<=n));do dodo ((i++)) done 2>/dev/null echo