]> mj.ucw.cz Git - eval.git/blob - mop/eval/mo-get-users.sh
Split mop/ to several subdirectories: admin, eval, public and score.
[eval.git] / mop / eval / mo-get-users.sh
1 #!/bin/bash
2
3 if [ "$1" = --help ] ; then
4         echo "Usage: mo-get-users [--full]"
5 fi
6 [ -f config ] || { echo "Missing config file, check cwd." ; exit 1 ; }
7 set -e
8 . config
9
10 if [ -z "$CT_USER_LIST" ] ; then
11         if [ "$1" = --full ] ; then
12                 FORM='$1,$5'
13         else
14                 FORM='$1'
15         fi
16         awk -F: </etc/passwd "{ gsub(\",.*\",\"\",\$5); OFS=\"\t\"; if (\$3 >= $CT_UID_MIN && \$3 <= $CT_UID_MAX) print $FORM; }"
17 else
18         if [ "$1" = --full ] ; then
19                 cut -d '        ' -f 1,2 <$CT_USER_LIST
20         else
21                 cut -d '        ' -f 1 <$CT_USER_LIST
22         fi
23 fi