Sorry my missinterpretation. I programmed CGI with Perl and just assumed you mean that too :P
Silly me.
Well, you will probably need to setup your server to know how to interpret your scripts.
As I recall it from Perl, you needed the first line to tell the server what language it is in:
in Perls case this was #!/usr/bin/perl
In your case it could be something like:
#!/bin/bash or #!/bin/sh
Anyway, you could then try to access this script from the webserver, like this:
http://localhost/script.cgi (presuming you named your script script.cgi and placed it in your webroot directory)