Difference between revisions of "Talk:Random Strong Password Generator"
From SME Server
Jump to navigationJump to searchm |
(Undo revision 32253 by RequestedDeletion (talk)) |
||
Line 2: | Line 2: | ||
#!/bin/bash | #!/bin/bash | ||
ARG=$1 | ARG=$1 | ||
− | if [[ ! $ARG =~ ^[ | + | if [[ ! $ARG =~ ^[0-9]+$ ]]; then |
echo "Invalid argument. Argument must be a positive number.";echo | echo "Invalid argument. Argument must be a positive number.";echo | ||
echo "Usage: randpw [n]";echo | echo "Usage: randpw [n]";echo |
Revision as of 05:03, 3 November 2016
Original code (/usr/bin/randpw)
#!/bin/bash ARG=$1 if [[ ! $ARG =~ ^[0-9]+$ ]]; then echo "Invalid argument. Argument must be a positive number.";echo echo "Usage: randpw [n]";echo logger -i ERROR: no positive integer provided, no password generated -t randpw else < /dev/urandom tr -dc '_A-Z-a-z-0-9!?@+[](){}~<>*%^&#+=\.$:;,-' | head -c${1:-$1};echo; exit 0 fi exit 0