0% found this document useful (0 votes)
9 views1 page

Lab 3 Class Tasks

The document outlines a series of OS lab tasks that involve writing shell scripts. Tasks include adding two numbers, counting words in a sentence, checking file existence and appending date/time, evaluating file/directory status, and developing a directory cleanup script. The cleanup script should remove old files and empty directories while providing user feedback on the process.

Uploaded by

Taaaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Lab 3 Class Tasks

The document outlines a series of OS lab tasks that involve writing shell scripts. Tasks include adding two numbers, counting words in a sentence, checking file existence and appending date/time, evaluating file/directory status, and developing a directory cleanup script. The cleanup script should remove old files and empty directories while providing user feedback on the process.

Uploaded by

Taaaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

QUESTION1:

OS LAB TASKS
Write a shell script that takes two numbers as command-line arguments, adds them, and prints
the result.
QUESTION2:

Write a script that accepts a sentence and counts the number of words in

it. QUESTION3:

Write a shell script that takes a filename as input, checks if it exists, and appends the current
date and time to it.

QUESTION4:

Write a Shell Bash Script for evaluate the status of a file/directory.

QUESTION5:
Directory Cleanup Script
Develop a bash script to automate directory cleanup tasks by removing old files and directories.
The script should:
a. Accept a directory path as an argument.
b. Identify and delete files older than a specified number of days.
c. Recursively remove empty directories within the specified directory.
d. Provide feedback to the user about the cleanup process, including the number of files
and directories removed.

You might also like