Skip to content

Instantly share code, notes, and snippets.

@CaptainCuddleCube
Last active March 5, 2021 15:49
Show Gist options
  • Save CaptainCuddleCube/976c1427b3ff937a29d72bf2aa34993c to your computer and use it in GitHub Desktop.
Save CaptainCuddleCube/976c1427b3ff937a29d72bf2aa34993c to your computer and use it in GitHub Desktop.
Simple password generator
#! /bin/sh
while getopts hn: flag
do
case "${flag}" in
n) length=${OPTARG};;
h) echo "-n for the number of random characters, -h for help"; exit 0;;
esac
done
base64 < /dev/random | head -c 1000 | sed 's/\+//g' | sed 's/\///g' | head -c $length | xargs echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment