随机生成8位字符串函数
程序员文章站
2022-05-21 12:58:06
...
啊啊
# 随机生成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`
上一篇: 程序员小测试 保守派VS*派
下一篇: 表述性状态转移