mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
11 lines
325 B
Text
11 lines
325 B
Text
# Generate a random string
|
|
#
|
|
# example: pwd=$(ynh_string_random 8)
|
|
#
|
|
# usage: ynh_string_random [length]
|
|
# | arg: length - the string length to generate (default: 24)
|
|
ynh_string_random() {
|
|
dd if=/dev/urandom bs=1 count=200 2> /dev/null \
|
|
| tr -c -d '[A-Za-z0-9]' \
|
|
| sed -n 's/\(.\{'"${1:-24}"'\}\).*/\1/p'
|
|
}
|