Skip to content

Instantly share code, notes, and snippets.

@markogresak
Created November 14, 2014 20:52
Show Gist options
  • Select an option

  • Save markogresak/2f1d7447883398afd0c4 to your computer and use it in GitHub Desktop.

Select an option

Save markogresak/2f1d7447883398afd0c4 to your computer and use it in GitHub Desktop.
function info {
if [[ -n "$1" ]]; then
OIFS=$IFS
IFS=':' read -a user <<< "$(getent passwd $1)"
if [[ "${user[0]}" != "$1" ]]; then
echo "$1: err"
else
printVals=()
if ((${user[2]} == ${user[3]})); then
printVals+=("enaka")
fi
if [[ -d "/home/$1" ]] || [[ -d "/home/student/$1" ]]; then
printVals+=("obstaja")
fi
echo "$1: ${printVals[*]} $(groups $1 | cut -d' ' -f3- | wc -w)"
fi
IFS=$OIFS
shift
info $@
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment