1.使用$RANDOM和md5sum
#echo $RANDOM | md5sum | sed ‘s/../&:/g‘ | cut -c1-17
2.使用openssl工具hex
[[email protected] ~]$ openssl rand -hex 6 |sed ‘s/../&:/g;s/:$//‘
9f:13:48:c1:f2:8d
3.使用perl命令
[[email protected] ~]$ perl -e ‘print join(":",map{sprintf "%0.2x",rand(256)}(1..6)), "\n"‘
38:7c:62:a3:9f:a0
原文地址:https://blog.51cto.com/1929297/2417454
时间: 2024-10-30 10:36:22