Skip to content

Instantly share code, notes, and snippets.

@arrjay
Created March 19, 2018 19:59
Show Gist options
  • Save arrjay/a7e69745413babd3def7dddcef6f0eff to your computer and use it in GitHub Desktop.
Save arrjay/a7e69745413babd3def7dddcef6f0eff to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
user=""
candidate=""
while [ -z "${user}" ] ; do
read -p "enter an existing username: " -r candidate
getent passwd "${candidate}" > /dev/null 2>&1 && user="${candidate}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment