summaryrefslogtreecommitdiffstats
path: root/.bin/password-gen
blob: e29dcb52b75915288c10b1c491710add53cfb373 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

pass_length="24"

usage() {
	cat <<-EOF
	usage: pagen [-l pass_length]
	EOF
}

main() {
	while getopts "l:" arg; do
		case "${arg}" in
			l)
				pass_length="${OPTARG-$pass_length}"
				;;
			*)
				usage
				exit 1
				;;
		esac
	done

	# generate and display password
	openssl rand -base64 "${pass_length}"
}

main $@
remember that computers suck.