Help with dynamic script

Hey there, first post, somewhat-long-time lurker-
This is on a Red Hat box
Im working on a new site, and I have an idea for a dynamic CGI script to change who is "on call"
Pretty much, it would pull next name from a text file each week to display it on the site, and just keeps cycling through the names forever.
I have the "shell" of the script, but I don't have the meat-n-potatoes.
What I got so far

#!/bin/bash
echo "Content-type: text/html"
echo
echo "<html>"
echo  "<head><title>Currently on call</title></head>
echo "<body>"
echo "<pre>"
SCRIPT HERE
echo "</pre></br>"
echo "</body>"
echo "</html>"

I want the SCRIPT part to pull line the next name from namelist.txt based on monday being the start of the week
there are 6 names
any help, would be awesome!

Your namelist.txt will be format as below. (the person, who was on duty, is marked by @)

$ cat namelist.txt
Peter
Thomas
Jenny
Simon
Chris
@Amy

With below command, you can get the next name.

#with above sample, name=Peter
name=$(awk '/@/ {c=NR} {a[NR]=$0}END{print (c==NR)?a[1]:a[c+1]}' namelist.txt )
echo "$name"

With below commands, you can get the file updated, (sed need support -i option)

sed -i 's/@//' namelist.txt
sed -i "s/$name/@$name/" namelist.txt

Put your script in cronjob, and run on Monday morning.

You are the best! I'll try it first thing in the morning!

No need for a cronjob to update the file, you can use the ISO weeknumber (as returned by %V from date) as the counter:

let NUM=$(date +%V)%6+1
sed -n "${NUM}p" namelist.txt

Above uses mod 6 to convert week of the year into number from 1 to 6.

It's also easy to get next/last week's name by simply adding/subtracting from the week number:

let NUM=($(date +%V)+1)%6+1
sed -n "${NUM}p" namelist.txt