shell

背景:

(1)通过内部系统变量($RANDOM)

echo $RANDOM

生成0-32767之间的整数随机数

----------------

附注:加法echo $((RANDOM+10))

这样也可以 echo $(($RANDOM+10))

 

(4)通过时间获得随机数(date)

date +%s%N       #生成19位数字,1287764807051101270

 

 

 

 

1、生成一个24位的随机密码

date +%s%N | md5sum | head -c 24

 head --help之后

Print the first 10 lines of each FILE to standard output.

 -c, --bytes=[-]K         print the first K bytes of each file;
                             with the leading `-', print all but the last
                             K bytes of each file
  -n, --lines=[-]K         print the first K lines instead of the first 10;

如打印文件前三行head -3 file1

 

posted @ 2016-01-20 17:28  welkinok  Views(312)  Comments(0Edit  收藏  举报