首页 > 系统服务 > 详细

shell

时间:2016-01-20 19:11:32      阅读:96      评论:0      收藏:0      [点我收藏+]

背景:

(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

 

shell

原文:http://www.cnblogs.com/welkinok/p/5145957.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!