summaryrefslogblamecommitdiffstats
path: root/.bin/password-gen
blob: e29dcb52b75915288c10b1c491710add53cfb373 (plain) (tree)



























                                                                    
#!/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.