Skip to content

Instantly share code, notes, and snippets.

@KaiSforza
Created March 22, 2016 02:54
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 KaiSforza/81641e78e2105444269e to your computer and use it in GitHub Desktop.
Save KaiSforza/81641e78e2105444269e to your computer and use it in GitHub Desktop.
# !/bin/bash
# Script recherche
# TP4 420-225-LI Hiver 2016
# Bénédict Brossard
__USERS=()
while true; do
read __USERNAME
[[ -n "${__USERNAME}" ]] && __USERS=(${__USERS[@]} "$__USERNAME") || break
done
for i in ${__USERS[@]}; do
__RET="$(awk -F: "/^([^:]*:){4}[^:]*$i/ {print \$1}" /etc/passwd)"
[[ -n ${__RET} ]] && echo "$__RET" || echo "----------"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment