Published by Niels on 14 Jan 2006 at 10:56 am
Why not…
Use Bourne Shell/BASH/Korn Shell/etc. as your CGI language? To me it would be the perfect fit with NanoBlogger to do my server side scripting. A short (but crude) example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/bin/bash echo "Content-type: text/html" echo "" cat << EOF <html> <head><title>Your environment variables</title></head> <body> EOF env cat << EOF </body> </html> EOF exit 0 |
Put this in in a file called test.cgi and put that file somewhere in a directory where your web page is hosted. Make sure that the following is set on test.sh:
chmod 755 yourdir
chmod 755 yourdir/test.cgi
Now point your browser to http://www.yourdomain.com/<yourdir>/test.cgi and behold, a nice overview of the environment variables your provider provides for you!
I think this is the perfect way to make a NanoBlogger powered site more interactive. Here are some nice examples of the things that can be done using Shell CGI scripting.
Although a comments addition for NanoBlogger can be found here I think I could give it a shot to implement the same functionality using Shell scripting. Not that I am opposed to using PHP and MySQL, but using Shell scripts seems a bit more pure to me in combination with NanoBlogger.
If there are any disadvantages and reasons why Shell scripting should not be used for this I would be glad to hear about it.
Update:
I renamed test.sh to test.cgi as my browser suggested to download the script rather then being executed on the server. And quotes have been put around “Content-type: text/html”. It is probably not necessary, but I like consistency.