Script:shell脚本生成随机字符串
2018-02-24 10:24
483 查看
#!/bin/bash # bash generate random alphanumeric string # # bash generate random 32 character alphanumeric string (upper and lowercase) and NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) # bash generate random 32 character alphanumeric string (lowercase only) cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 # Random numbers in a range, more randomly distributed than $RANDOM which is not # very random in terms of distribution of numbers. # bash generate random number between 0 and 9 cat /dev/urandom | tr -dc '0-9' | fold -w 256 | head -n 1 | head --bytes 1 # bash generate random number between 0 and 99 NUMBER=$(cat /dev/urandom | tr -dc '0-9' | fold -w 256 | head -n 1 | sed -e 's/^0*//' | head --bytes 2) if [ "$NUMBER" == "" ]; then NUMBER=0 fi # bash generate random number between 0 and 999 NUMBER=$(cat /dev/urandom | tr -dc '0-9' | fold -w 256 | head -n 1 | sed -e 's/^0*//' | head --bytes 3) if [ "$NUMBER" == "" ]; then NUMBER=0 fi
相关文章推荐
- Shell脚本批量创建用户并随机生成密码
- 运维技巧系列之shell随机生成密码脚本
- linux下利用shell脚本随机生成密码
- Shell脚本批量创建用户并随机生成密码
- 用Shell实现双色球 随机生成篮球 红球的脚本.
- shell脚本实现随机生成10个8位密码
- shell下的随机字符串生成
- 使用Shell脚本生成随机单词
- shell随机生成十位密码脚本
- Shell创建用户并生成随机密码脚本分享
- Shell脚本生成随机密码的若干种可能
- shell 生成指定范围随机数与随机字符串 .
- shell完成指定范围随机字符串生成
- shell随机生成十位密码脚本
- Shell: 生成随机字符串
- shell 生成指定范围随机数与随机字符串
- shell 生成指定范围随机数与随机字符串
- linux shell 生成随机字符串脚本
- shell 生成指定范围随机数与随机字符串
- shell脚本实现随机生成10个8位密码