Weeks 6 - 8
UNIX shell scripts with CGI
Let's do that Friday October 14th
Assignment 4: Due Friday, October 10th
Assignment #5: Due: Monday, November 7th (note change of due date)
Part A -- Estimating John Hancocks in the United States. -- Note: owing to complexities in Census bureau's rework of the population clock as well as new security constraints on obsidian's CGI environment, just plug in this comma-delimited number into your script for the current population :
324,809, 640 (as of 11:06 pm October 28, 2016)
Some useful (?) things for using UNIX:
You may want to revisit the page on doing arithmetic in UNIX -- particularly the bc command.
A little script that may help with the parsing of web pages (using lynx -dump) can be seen here. (Note: your version of UNIX/Linux may use "links" instead of "lynx").
Here's a link on how to generate random numbers in the shell, using $RANDOM.
Or, here's a little PERL program you can use to return an integer between 0 and 222:$ /homes/ddailey/rand 223219$ /homes/ddailey/rand 22336$ /homes/ddailey/rand 223149$ /homes/ddailey/rand 223183
(See also: How to make a cgi/shell script run over the web)
How to make an executable script run over the web:
1. Place it in yourhomedirectory/public_html/cgi
2. Add three "magic" lines to the beginning of the code:
#!/bin/shecho "Content-type: text/html"echo
Let's analyze some ways of calling such a script.
use AJAX (an example that looks up words in a dictionary as you type)