aboutsummaryrefslogtreecommitdiff
path: root/mkpass
blob: c95f141bda9bae760b288f2b6eccf479f51a883f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

set -e

usage()
{
	echo "Usage: ${0##*/} [-l length] [chars]" >&2
	exit 1
}

while getopts 'l:' o; do
	case "$o" in
	l) len="$OPTARG" ;;
	*) usage         ;;
	esac
done

shift $((OPTIND - 1))
[ $# -gt 1 ] && usage
</dev/urandom tr -dc -- "${1:-[:graph:]}" | head -c "${len:-64}"
echo