Skip to content

Instantly share code, notes, and snippets.

@jairajsahgal
Created March 18, 2021 07:58
Show Gist options
  • Save jairajsahgal/2a55797e3766235be254f507ff64df9b to your computer and use it in GitHub Desktop.
Save jairajsahgal/2a55797e3766235be254f507ff64df9b to your computer and use it in GitHub Desktop.
Password Generator in Bash
#!/bin/bash
# Simple password generator
echo "This is a simple password generator"
echo "Please enter the length of the password"
read PASS_LENGTH
echo "Please enter number of passwords to be generated"
read NO_OF_PASS
echo "Enter website for which password is to be generated"
read COMPANY
touch "$COMPANY.txt"
for p in $(seq 1 $NO_OF_PASS); do
temp=`openssl rand -base64 48 | cut -c1-$PASS_LENGTH`
echo $temp>>"$COMPANY.txt"
done
@jairajsahgal
Copy link
Author

It generates passwords according to the user password length, and number of passwords to be generated.
It also stores those passwords in the specified website text file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment