Bash (CGI) error

software development

#1

Does anyone know why this (simple) bash script produces
"Premature end of script headers" in the apache error log?

The script is saved as test.cgi. file chmod=655. Dir=655.
I cannot see anything what is wrong with it. (OK - it’s 1am at the moment - give me a break!)

#!/bin/bash
echo "Content-Type: text/html"
echo ""
echo ""
echo "Bash as CGI"
echo ""
echo "

Hello world

"
echo "
echo “”

#2

CGI scripts are executed as your user. The script therefore needs to have user read and execute permissions (700). There is no need to allow group and other access.

You are also missing a close quote on the second to last line.


#3

Also, you might want to close the html tag in the last line.

-Matttail


#4

Thanks both of you.
Now that I’ve woken up after a good nights sleep, it was obvious 8))