bash 字符串长度
How to get a 10-byte length random string in bash.
如何在bash中获取10字节长度的随机字符串 。
Use this script to get a 10-byte string of letters:
使用此脚本可获取10字节的字母字符串:
tr -dc "[:alpha:]" < /dev/urandom | head -c 10
You can also get a string of letters or numbers:
您还可以获取一串字母或数字:
tr -dc "[:alnum:]" < /dev/urandom | head -c 10
Or printable characters except space:
或除空格以外的可打印字符:
tr -dc "[:graph:]" < /dev/urandom | head -c 10
Or printable characters including space:
或包含空格的可打印字符:
tr -dc "[:print:]" < /dev/urandom | head -c 10
Answered by anonymous.
匿名回答。
翻译自: https://www.systutorials.com/how-to-get-a-10-byte-length-random-string-in-bash/
bash 字符串长度