Skip to content

Instantly share code, notes, and snippets.

@ckxng
Created January 18, 2020 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckxng/e7a11b64046d9e8c988d9caa98a249e3 to your computer and use it in GitHub Desktop.
Save ckxng/e7a11b64046d9e8c988d9caa98a249e3 to your computer and use it in GitHub Desktop.
generate user profiles with names, logins, birthdays, and email addresses
#!/bin/bash
# Constants
X=0
FNAMES_F=~/share/dict/fnames # a file of newline separated first names
LNAMES_F=~/share/dict/lnames # a file of newline separated last names
# total number of non-random words available
FNAMES_SZ=`cat ${FNAMES_F} | wc -l`
LNAMES_SZ=`cat ${LNAMES_F} | wc -l`
# while loop to generate random words
# number of random generated words depends on supplied argument
FNAME=`sed $(echo $(( 1 + RANDOM % ${FNAMES_SZ} )) )"q;d" $FNAMES_F `
FI=`echo ${FNAME} | cut -c1`
MNAME=`sed $(echo $(( 1 + RANDOM % ${FNAMES_SZ} )) )"q;d" $FNAMES_F `
MI=`echo ${MNAME} | cut -c1`
LNAME=`sed $(echo $(( 1 + RANDOM % ${LNAMES_SZ} )) )"q;d" $LNAMES_F `
MMNAME=`sed $(echo $(( 1 + RANDOM % ${LNAMES_SZ} )) )"q;d" $LNAMES_F `
MM=$(( 1 + RANDOM % 12 ))
DD=$(( 1 + RANDOM % 28 ))
YY=$(( 80 + RANDOM % 10 ))
dicegen # or other password generation tool
echo "login: ${FI}${MI}${LNAME}${YY}"
echo "name: ${FNAME} ${MNAME} ${LNAME}"
echo "birthday: ${MM}/${DD}/${YY}"
echo "email: ${FNAME}.${MI}.${LNAME}${YY}@example.com"
echo "mothers-maiden: ${MMNAME}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment