From 0f08d04698c814955116b6bae50752e64b774d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Thu, 23 Dec 2021 18:28:03 +0000 Subject: Thu Dec 23 06:28:03 PM UTC 2021 --- .bin/password-gen | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 .bin/password-gen (limited to '.bin/password-gen') diff --git a/.bin/password-gen b/.bin/password-gen new file mode 100755 index 0000000..e29dcb5 --- /dev/null +++ b/.bin/password-gen @@ -0,0 +1,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 $@ -- cgit v1.2.3