mirror of
https://github.com/tildeclub/site.git
synced 2026-06-08 22:20:18 +00:00
fix indentation of cgi script examples
This commit is contained in:
@@ -125,64 +125,64 @@ would be noted in each example.
|
|||||||
- Perl
|
- Perl
|
||||||
(also works with <q><samp>.pl</samp></q> file extension):
|
(also works with <q><samp>.pl</samp></q> file extension):
|
||||||
|
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
print "Status: 200\n";
|
print "Status: 200\n";
|
||||||
print "Content-Type: text/plain\n";
|
print "Content-Type: text/plain\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "Hello World!\n";
|
print "Hello World!\n";
|
||||||
|
|
||||||
Note that Perl was the main language of choice
|
Note that Perl was the main language of choice
|
||||||
back in the heyday of CGI programming.
|
back in the heyday of CGI programming.
|
||||||
- Bourne shell script
|
- Bourne shell script
|
||||||
(also works with <q><samp>.sh</samp></q> file extension):
|
(also works with <q><samp>.sh</samp></q> file extension):
|
||||||
|
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
echo "Status: 200"
|
echo "Status: 200"
|
||||||
echo "Content-Type: text/plain"
|
echo "Content-Type: text/plain"
|
||||||
echo
|
echo
|
||||||
echo "Hello World!"
|
echo "Hello World!"
|
||||||
- Python
|
- Python
|
||||||
(usable under both 3.x and 2.x,
|
(usable under both 3.x and 2.x,
|
||||||
also works with <q><samp>.py</samp></q> file extension):
|
also works with <q><samp>.py</samp></q> file extension):
|
||||||
|
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
print("Status: 200")
|
print("Status: 200")
|
||||||
print("Content-Type: text/plain")
|
print("Content-Type: text/plain")
|
||||||
print("")
|
print("")
|
||||||
print("Hello World!")
|
print("Hello World!")
|
||||||
- AWK:
|
- AWK:
|
||||||
|
|
||||||
#!/usr/bin/awk -E
|
#!/usr/bin/awk -E
|
||||||
BEGIN {
|
BEGIN {
|
||||||
print "Status: 200"
|
print "Status: 200"
|
||||||
print "Content-Type: text/plain"
|
print "Content-Type: text/plain"
|
||||||
print
|
print
|
||||||
print "Hello World!"
|
print "Hello World!"
|
||||||
}
|
}
|
||||||
- Lua
|
- Lua
|
||||||
(also works with <q><samp>.lua</samp></q> extension):
|
(also works with <q><samp>.lua</samp></q> extension):
|
||||||
|
|
||||||
#!/usr/bin/lua
|
#!/usr/bin/lua
|
||||||
print("Status: 200")
|
print("Status: 200")
|
||||||
print("Content-Type: text/plain")
|
print("Content-Type: text/plain")
|
||||||
print("")
|
print("")
|
||||||
print("Hello World!")
|
print("Hello World!")
|
||||||
- Tcl:
|
- Tcl:
|
||||||
|
|
||||||
#!/usr/bin/tclsh
|
#!/usr/bin/tclsh
|
||||||
puts "Status: 200"
|
puts "Status: 200"
|
||||||
puts "Content-Type: text/plain"
|
puts "Content-Type: text/plain"
|
||||||
puts ""
|
puts ""
|
||||||
puts "Hello World!"
|
puts "Hello World!"
|
||||||
- Common Lisp:
|
- Common Lisp:
|
||||||
|
|
||||||
#!/usr/bin/sbcl --script
|
#!/usr/bin/sbcl --script
|
||||||
(progn
|
(progn
|
||||||
(princ "Status: 200") (terpri)
|
(princ "Status: 200") (terpri)
|
||||||
(princ "Content-Type: text/plain") (terpri)
|
(princ "Content-Type: text/plain") (terpri)
|
||||||
(terpri)
|
(terpri)
|
||||||
(princ "Hello World!") (terpri)
|
(princ "Hello World!") (terpri)
|
||||||
)
|
)
|
||||||
|
|
||||||
Pick the language you like,
|
Pick the language you like,
|
||||||
put the script (or executable) in a file anywhere inside your <q>`public_html`</q> subdirectory
|
put the script (or executable) in a file anywhere inside your <q>`public_html`</q> subdirectory
|
||||||
|
|||||||
Reference in New Issue
Block a user