Skip to content

Instantly share code, notes, and snippets.

@spikegrobstein
Created November 2, 2010 23:23
Show Gist options
  • Save spikegrobstein/660506 to your computer and use it in GitHub Desktop.
Save spikegrobstein/660506 to your computer and use it in GitHub Desktop.
random password generator for OSX
#! /bin/bash
##
# spit out random password. default length of 32 characters
# usage:
# ./random_pw <pw_length>
##
COUNT=$1
DEFAULT_COUNT=32
if [[ $1 = 0 || $1 -eq '' ]]; then
COUNT=$DEFAULT_COUNT
fi
head -c $COUNT /dev/random | uuencode -m - | tail -n 2 | head -n 1 | head -c $COUNT
echo "" # output newline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment