4.10 Three bash
scripts
Using a text editor, create three
(3) bash
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
bash
shell. Accept an argument and print out all
prime numbers less than the passed argument. (Look at
factor
(1).)
- 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 bash
scripts
Please turn your lab to Louis Taber or to Pima Community
College employee
in room A-115 of the Santa Rita Building.
Ask them to place it in the dark blue folder in
Louis Taber's mailbox.
Instructor: ltaber@pima.edu ** My new Home at GeoApps in Tucson ** The Pima College Site