随机生成8位字符串函数
程序员文章站
2022-05-21 12:59:36
...
啊啊
# 随机生成8位字符串函数randstr randstr() { index=0 str="" for i in {a..z}; do arr[index]=$i; index=`expr ${index} + 1`; done for i in {A..Z}; do arr[index]=$i; index=`expr ${index} + 1`; done for i in {0..9}; do arr[index]=$i; index=`expr ${index} + 1`; done for i in {1..8}; do str="$str${arr[$RANDOM%$index]}"; done echo ${str} } echo `randstr`