Austrian Linux Forum

Simpler Passwortgenerator

#!/bin/bash

#$1 = length
#$2 = count
echo "USAGE: $0 LENGTH COUNT"
echo "default is LENGTH=8 COUNT=1"
echo ""
LENGTH=8
COUNT=1

if [ -n "$2" ]
then
        COUNT=$2
fi
if [ -n "$1" ]
then
        LENGTH=$1
fi

for ((n=0;n < $COUNT;n++)); do dd if=/dev/urandom count=1 2> /dev/null | uuencode -m -| sed -ne 2p | cut -c-$LENGTH; done

uuencode muss ggf. nachinstalliert werden.

Kommentare