type
Post
status
Published
date
Nov 16, 2022 03:09
slug
article/shell-random-string
summary
tags
Tech
DevOps
category
Code
icon
💻
password
一般在写shell脚本的时候,会有需要生成一些随机字符,比如在写批量生成用户+随机密码的脚本的时候,就会用到随机生成的字符串来作为新建用户的密码。以下的几种方式可以随机生成字符串。当然,还要许多方法都能完成文章标题的目的,这里仅列举出来部分的。
1.使用shell的random变量
2.使用openssl
3.random+openssl混合
4.mkpasswd方法
5.uuid方法
6.dev方法
7.date日期方法
8.for循环方法
- Author:Hang Ke
- URL:https://hang.ke/article/article/shell-random-string
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts
