![]() ![]() Creating CGI Programs with Bash: IntroductionFor the impatient, jump straight to Page 2 - Creating CGI Programs with Bash: Getting StartedQuick IntroductionWhat is a CGI?A CGI (Common Gateway Interface) is a program that runs on a web server. CGIs are typically called from HTML forms, and usually are designed to run quickly and return an HTML page someone can use in a browser.What is Bash?Bash (Bourne-Again SHell) is a shell for UNIX, Linux, (and other operating systems). Bash is similar to the Bourne shell (sh), and can most Bourne-shell scripts, but adds many capabilities and improvements. As a shell, Bash can be used in two ways: interactive, where it presents a powerful command line to the user, and as a script interpreter, which is how it is used when used to run CGI programs.Why use Bash to write CGI programs?While Bash is not the most common language for writing CGI programs in, it has some advantages:
Why not to use Bash for writing CGI programs?Although Bash has its advantages when it comes to writing CGI programs, it also has some disadvantages that are worth mentioning:
Finally, a note of cautionThis guide is about writing CGI programs. Any CGI program carries a potential security risk with it, since it allows data to be sent to a web server and processed their. A poorly written CGI program, in any language, including Bash, can leave a server open to attack or consume its resources, slowing it down or crashing it. The biggest risk of a CGI program is that it will be vulnerable to some attack and allow the server (and site) running it to become compromised. You should be aware of these risks before writing CGI code, and take care to do your best to write good, secure code that checks for errors, unexpected, and unwanted input or behavior and works around it. You should also be aware that not every hosting provider allows you to write and run your own CGI programs, and that many that do will deactivate your site if you write a CGI program that causes the host's server problems or causes it to get compromised. Talk to your hosting provider if you are unsure if you are allowed to run CGIs or not. Regardless, it is your responsibility to keep your CGIs safe, secure, and not write CGIs that can do potentially harmful things (ie it would be a bad idea to write a program that allows someone to remove files from your site, even if its at a hidden URL. Don't write CGIs that can do things you wouldn't want someone else or some automated virus or bot doing to your site!). Page 2 - Creating CGI Programs with Bash: Getting Started -->TigerTronics is primarily sponsored by ![]() |
||