commit 7ff13afa942736112b0dd8c45336db48e6a2eaff Author: aboutDavid <62346025+aboutDavid@users.noreply.github.com> Date: Mon Mar 8 21:19:58 2021 -0500 Inital Commit diff --git a/guestbook b/guestbook new file mode 100644 index 0000000..9b581a2 --- /dev/null +++ b/guestbook @@ -0,0 +1,34 @@ +#!/bin/bash +PATH_TO_GUESTBOOK="/home/aboutdavid/public_html/guestbook.txt" +PATH_TO_SCRIPT="/home/aboutdavid/guestbook" +URL="https://tilde.club/~aboutdavid/guestbook.txt" +TIMEZONE="EST" + +# help page +if [ "$1" = "-h" ] +then + echo "Welcome to guestbook! This is a script made by ~aboutdavid (lol that's me) so people can comment on my website. Run $PATH_TO_SCRIPT [COMMENT] to comment." + exit 0 +fi + +# This probs isn't needed but idk +if [ "$LOGNAME" != "$USER" ] +then + echo "Failed authentication for guestbook. You may want to restart your SSH session to fix this error." + exit 1 +fi + +if [ "$1" != "" ] +then + TEXT=$1 + TZ=$TIMEZONE + DATE=$(date +"%B %d, %Y (%r)") + echo "From $USER:" >> $PATH_TO_GUESTBOOK + echo $TEXT >> $PATH_TO_GUESTBOOK + echo "Written on $DATE" >> $PATH_TO_GUESTBOOK + echo "" >> $PATH_TO_GUESTBOOK + echo "Thanks for adding something to my guestbook! Visit $URL to see it!" +else + echo "You didn't give me any text to add to the guestbook :(. Run $PATH_TO_SCRIPT -h for more infomation." + exit 1 +fi \ No newline at end of file