Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Ortiz, John Michael C.

LT#2/ COE197P

Instructions: Complete the following exercises. Provide the source code and all commands taken to
satisfy the given questions.

1. Create a Bash script named my_stat which will accept a file as a command line argument and
analyze the following:
2. Use the date command to determine if it is morning (before 12:00 noon), afternoon (between
12:00 and 6:00 p.m.) or evening (after 6:00 p.m.). Depending on the time, create a shell program
called greeting that will echo out the appropriate message: good morning, good afternoon or
good evening.

3. Create a replacement for the rm command called remove. The script should prompt for the file
to be deleted. You should be able to delete files and directories. Ensure that your program handles
the following:
a. The program should be able to accept command line arguments for the following options.

i. -l This will list the files and directories under your recycle_bin directory.
ii. -d This will delete files and directories under your recycle_bin directory.
iii. -r This will restore files or directories to the directory specified by the user

b. If the user will not give any arguments, prompt the user to type the files or directories to
be deleted and store that files or directories under your recycle_bin directory.

c. Confirm if the user wants to continue executing the program, if yes run again the program
and if not, terminate the program.

You might also like