finger/luser

74 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
. /etc/efingerd/log
if [ "$1" = "(null)" ]; then
printf "\nhello %s,\n\n" "$2"
else
printf "\nhello %s@%s\n\n" "$1" "$2"
fi
if [ "$3" = "root" ]; then
printf "you've reached\n"
figlet -f smslant envs.net
cat <<EOM
envs.net is a minimalist, non-commercial
shared linux system and will always be free to use.
we are linux lovers, programmer and users who like build webpages,
write blogs, chat online, play cool console games and so much more.
you wish to join with an small user space?
https://envs.net/
https://envs.net/signup/
EOM
elif [ "$3" = "gopher" ]; then
printf "try port 70 :)\n\n"
printf "gopher://envs.net\n"
else
user_folder="/home/${3}"
#/usr/bin/finger -m "$3"
# Plan
printf "Plan:\\n"
if [ -f "${user_folder}/.plan" ]; then
sed 's/^/ /' "${user_folder}/.plan"
else
printf "No Plan.\n"
fi
# Pronouns
printf "Pronouns:\\n"
if [ -f "${user_folder}/.pronouns" ]; then
sed 's/^/ /' "${user_folder}/.pronouns"
fi
# Projects
printf "Projects:\\n"
if [ -f "${user_folder}/.project" ]; then
sed 's/^/ /' "${user_folder}/.project"
fi
# Timezone
if [ -f "${user_folder}/.tz" ]; then
printf "Timezone: "
cat "${user_folder}/.tz"
printf "\n"
fi
# Online status
if finger "$3" | grep -q 'On since'; then
printf "Online.\n"
fi
fi
exit 0