forked from tilde.black/ops
20 lines
576 B
Bash
Executable File
20 lines
576 B
Bash
Executable File
#!/bin/sh
|
|
|
|
all_users=$(grep /home < /etc/passwd | awk -F: '{print $1}' | sort)
|
|
|
|
output="/var/www/htdocs/users.partial"
|
|
printf "<h3>Users:</h3>\\n" > "$output"
|
|
printf "<ul>\\n" >> "$output"
|
|
printf "%s" "$all_users" | while read -r n; do
|
|
if [ -f "/var/www/htdocs/users/${n}/index.html" ]; then
|
|
printf "<li><a href='/users/%s'>~%s</a></li>\\n" "$n" "$n" >> "$output"
|
|
fi
|
|
done
|
|
printf "</ul>\\n" >> "$output"
|
|
|
|
cat /var/www/htdocs/head.partial \
|
|
/var/www/htdocs/intro.partial \
|
|
/var/www/htdocs/users.partial \
|
|
/var/www/htdocs/foot.partial > /var/www/htdocs/index.html
|
|
|