From da28ee4ccf8d8a99172c523efcb06bbce1bb4f62 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 18 Apr 2018 03:26:55 +0100 Subject: [PATCH] etc/profile.d/functions --- etc/profile.d/functions | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/profile.d/functions b/etc/profile.d/functions index d91558e0..010535e4 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -833,10 +833,10 @@ http_head() { fi } -password_create() { - tr -cd '[:alnum:] #$,;.:*@[]()?+=_%-' < /dev/urandom | head -c${1:-30} - #tr -cd '[:alnum:]!@#$%^&*_+-,./?' < /dev/urandom | head -c${1:-30} - #tr -cd '!-~' < /dev/urandom | head -c${1:-30} +random_string() { + local len=${1:-30} + local chars=${2:-'[:alnum:] #$,;.:*@[]()?+=_%-'} + tr -cd "$chars" < /dev/urandom | head -c${1:-${len}} echo } -- 2.47.3