(转)Linux下生产随机字符

#!/bin/sh

alphabeta="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"
number="0 1 2 3 4 5 6 7 8 9"

A=($alphabeta) # save as array
N=($number)
num_a=${#A
  • }
  • num_n=${#N
  • }

  • echo ${A[$((RANDOM%num_a))]}${N[$((RANDOM%num_n))]}

    猜你喜欢

    转载自jackyrong.iteye.com/blog/1759892