forked from cafe/site
1
0
Fork 0

fix user list to handle usernames including '_' char correctly

This commit is contained in:
Kevin Nobel 2023-06-13 09:47:26 +02:00
parent 4c5966d48d
commit f2138aabca
No known key found for this signature in database
GPG Key ID: 3315E34C37CA7D87
1 changed files with 4 additions and 3 deletions

View File

@ -5,11 +5,12 @@ echo "# user list"
# exclude lost+found and testuser
for user in $(ls /home/ -1 | grep -v \+ | grep -v testuser)
do
user_esc=$(echo "$user" | sed 's/_/\\_/g')
if [ "$(stat -c %G "/home/$user")" == "deleted" ];then
echo "<del>~$user</del> ";
echo "<del>~$user_esc</del> ";
else if [ "$(stat -c %G "/home/$user")" != "banned" ];then
echo "[~$user](/~$user) ";
echo "[~$user_esc](/~$user) ";
else
echo "~$user ([banned](banned.html#$user)) ";
echo "~$user_esc ([banned](banned.html#$user)) ";
fi;fi
done