isekai.rocks/cgi/lsuser
2024-11-21 23:45:12 +00:00

21 lines
486 B
Bash
Executable File

#!/bin/sh
all_users="$(ls -1 /home/)"
online_users="$(who -u | awk '{ print $1 }' | sort | uniq)"
printf "20 text/gemini\r\n"
printf "# Users\r\n"
printf "There are $(echo "${all_users}" | wc -l) total users; $(who -q | tr '=' '\n' | tail -n1) are currently online.\r\n\r\n"
printf "## Online Users\r\n"
for user in $online_users; do
printf "=> /~${user} ${user}\r\n"
done
printf "\r\n"
printf "## All Users\r\n"
for user in $all_users; do
printf "=> /~${user} ${user}\r\n"
done