#!/bin/bash echo "# user list" # exclude lost+found and testuser for user in $(ls /home/ -1 | grep -v \+ | grep -v testuser) do if [ "$(stat -c %G "/home/$user")" == "deleted" ];then echo "~${user//_/\\_} "; else if [ "$(stat -c %G "/home/$user")" != "banned" ];then # Escape underscores (note that username is '[a-z][-0-9a-z_]{2,}') echo "[~${user//_/\\_}](/~$user) "; else echo "~${user//_/\\_} ([banned](banned.html#$user)) "; fi;fi done