#!/bin/sh # Simple random string generator for passwords and usernames # $LEN initial declaration commented out for runtime LEN config LC_ALL=C #LEN=${LEN:-24} ALPHA="A-Za-z" NUM="0-9" SPECIAL='!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' random() { /dev/null ; echo } case $1 in pass) random ;; user) LEN=${LEN:-12} SPECIAL='' random ;; *) printf "Usage: $0 pass|user\nSet LEN environment variable for length" ;; esac