drop config for centos 7
[dotFiles.git] / .bash / genpasswd.sh
blob788161dc742fd0044ef55addbe26c9679e97f9d9
1 #! /usr/bin/env bash
3 # genpassword.sh
5 # Distributed under terms of the GPLv3 license.
8 _help () {
9 echo "genpasswd.sh: A Password Generator\n
10 Usage: genpasswd.sh [length] [count]\n
11 e.g.
12 genpasswd.sh 16 5"
13 exit 0
16 [[ "$1" -gt 0 ]] && _length=$1 || _help
17 [[ "$2" -gt 0 ]] && _count=$2 || _count="1"
19 _genpasswd () {
20 local _strings="[:alnum:]!@#$%^&*(){}"
21 LC_ALL=C tr -dc $_strings < /dev/urandom | head -c $_length | xargs
24 for ((counts = 1; counts <= "$_count"; counts++))
26 _genpasswd
27 done