4.10 Three tcsh scripts
Using a text editor, create three
(3) "C" shell programs. You have many options. This is a
list of possibilities. If you have a specific project in mind,
check with me.
- Write a prime number program
using the "C" shell. Accept an argument and print out all
prime numbers less than the passed argument. (Look at
factor
(1).)
- Get current earthquake information from the Internet. Look at the
quake alias for starters. (The Internet keeps changing.)
Strip out all of the data except the large earthquakes (
grep
).
Place this information in a file (create it if necessary).
Then take this file and sort (sort
) it. After it is sorted remove
lines that are the same (uniq
). Display this result and place
it back into the above file for next time.
This should work in such a manner that if you run
it at a later date, the file accumulates
earthquake information. The shell script
needs to store information from one
login to the next.
- Process the
/etc/passwd
file to create a list of unique user
numbers and a list of unique group numbers. Title each list.
- List the last (about) 25 users that are on (were on) the system
in alphabetic order by user name. Use the
last -100
command
to create a list of possible users. Then use cut
,
sort
, and
uniq
to arrange the list.
- Write a "tree" script. Do a recursive directory search and
display it with an indented format. There is no need to attempt
to use special graphic characters. As the first and only required
argument, pass the path location to start your tree. Do not display
the files in the directories, unless that is an option of your
shell script.
- Write a "useful" shell script, and a note to me explaining
why it is useful.
Make a printout of your output and
shell script, mark it with:
your name
TABER CIS137
Lab 4.10: Three tcsh scripts
Place the lab in the instructor hand-in box
in BUS R6E, the "terminal room".
Instructor: ltaber@pima.edu ** My new Home at GeoApps in Tucson ** The Pima College Site ** The Mad Dr. G.'s home page on phred.