Originally Posted by KSUA
Is there a way to have this script run as a result of a click event on a webpage?
You have to set up CGI in your webserver, so that it will execute bash
scripts (if you chose to write the script in bash
). Then, use a script like this:
if [ -f "$COUNT_FILE" ]; then
sed -e "s/Event $count/Event $next/; s/id_$count/id_$next/" "Event$count.txt" > "Event$next.txt"
echo -n $next > $COUNT_FILE
You might need to put a cd
in the beginning of the script (to the data directory), and will obviously need write permissions in that directory and to the files. You might want to write your script in Perl, as I am not very knowledgeable about the security implications of CGI bash scripts.
As an aside, what exactly are you trying to accomplish? If the Event files are served up as web content, you might serve them dynamically instead of making almost-identical copies on your server’s disk.