X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fcore%2Ffunctions.sh;h=3a86546be0abcc7a9f1b00b6c4c7e9cb306791a7;hb=482a9f6c16ce5f52b5ea48efd76a3db13e36385a;hp=fe56aea63a2624d73f5603b55264d0aa56064444;hpb=e715c6598343dd15a8652cd22923c4e48aaf1aef;p=feisty_meow.git diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index fe56aea6..3a86546b 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -238,6 +238,17 @@ if [ -z "$skip_all" ]; then nechung } + # generates a random password where the first parameter is the number of characters + # in the password (default 20) and the second parameter specifies whether to use + # special characters (1) or not (0). + # found function at http://legroom.net/2010/05/06/bash-random-password-generator + function random_password() + { + [ "$2" == "0" ] && CHAR="[:alnum:]" || CHAR="[:graph:]" + cat /dev/urandom | tr -cd "$CHAR" | head -c ${1:-32} + echo + } + function function_sentinel() { return 0; } if [ ! -z "$SHELL_DEBUG" ]; then echo function definitions end....; fi