Unix Exercises
Do the following exercises in your ruby.ils.unc.edu account.
-
Create a directory named "ex1" and copy the following
two files into it. Try using a wildcard character
to copy both files at once.
/htdocs/courses/2008_spring/inls760_001/ex1/sample1.txt
/htdocs/courses/2008_spring/inls760_001/ex1/sample2.txt
-
Read the man page for the Unix uniq command.
Use the sort and uniq commands along with the pipe operator
to write a one-line statement that will list all the
lines that appear in both sample1.txt and sample2.txt
(i.e. the intersection of the two files).
-
Do the same as above, execpt instead of showing the intersection
of the two files on the screen, write the lines out to a file
called overlap.txt
-
Set the permissions on the overlap.txt file so that
you can read and write the file, users in your group can
read the file, and all other users of the system
cannot read or write the file. No other permissions
should be set.
PHP Exercises
Do the following exercises in your ruby.ils.unc.edu account.
-
Write a php script that creates a three-dimensional array
called "circle" with the following data:
area circumference
1 3 6
2 12 12
3 28 18
The php script should then loop through all the keys (i.e., 1, 2, 3)
and print the area and circumference for each key.
-
Write an html page with a form with 2 fields (username and password)
and a submit button labelled "Login".
Make the username be a text field and the password be a password field.
Have the form action be to call a php script called login.php.
The php script should return a message saying "Hi username!" if the
password matches "12345". If the password does not match "12345",
then the script should print "Wrong password."
If the password is wrong, for this simple example, users will
have to use the back button on their browser to try again.
|