1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pleroma_ynh.git synced 2024-09-03 20:15:59 +02:00

Random string in common.sh

This commit is contained in:
anmol 2018-11-04 23:30:21 +05:30
parent a36b415779
commit 4b2122d82b

View file

@ -12,6 +12,14 @@ ynh_delete_file_checksum () {
ynh_app_setting_delete $app $checksum_setting_name ynh_app_setting_delete $app $checksum_setting_name
} }
# usage: ynh_string_random [length]
# | arg: length - the string length to generate (default: 24)
ynh_string_random() {
dd if=/dev/urandom bs=1 count=1000 2> /dev/null \
| tr -c -d 'A-Za-z0-9' \
| sed -n 's/\(.\{'"${1:-24}"'\}\).*/\1/p'
}
# Send an email to inform the administrator # Send an email to inform the administrator
# #
# usage: ynh_send_readme_to_admin app_message [recipients] # usage: ynh_send_readme_to_admin app_message [recipients]