Linux Random Password Generator With Bash Script

by lifeLinux on April 24, 2011

#!/bin/bash
# Under RedHat / Centos

if [ $# -gt 0 ]
then
	MIN=$1
else
	MIN=8
fi

DEL=`expr $RANDOM % 5`
LEN=`expr $MIN + $DEL`
cat /dev/urandom | tr -dc "a-zA-Z0-9@#*=[]" | dd  bs=$LEN count=1 2>/dev/null
echo;

Leave a Comment

Previous post:

Next post: