0% found this document useful (0 votes)
34 views

Systems Software/Programming - Lab Manual

This document provides instructions for a lab assignment involving shell scripting. Students are asked to write 4 shell scripts that perform tasks like summing command line arguments, counting files recursively in a directory, deleting empty subdirectories, and removing duplicate lines from a text file. The scripts and their output must be packaged and named according to the given format, with everything submitted as a zip file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Systems Software/Programming - Lab Manual

This document provides instructions for a lab assignment involving shell scripting. Students are asked to write 4 shell scripts that perform tasks like summing command line arguments, counting files recursively in a directory, deleting empty subdirectories, and removing duplicate lines from a text file. The scripts and their output must be packaged and named according to the given format, with everything submitted as a zip file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Systems Software/Programming – Lab Manual

______________________________________________________________________________

Lab 2 – Shell Programming/Scripting

You will be required to write shell scripts for a given problem. After running each
of the shell script, you will need to capture the output.
Shell script file will be named as StudentID_Lab2_x.sh
output captured will be names as StudentID_Lab2_x.txt or image file
StudentID_Lab2_x.png

1. Write a shell script StudentID_Lab2_1.sh which will take up to 9 (i.e. 1 to 9)


command line arguments as integer values and sum them up.

2. Write a shell script StudentID_Lab2_2.sh that will take a directory path (e.g. /usr)
as input and counts all the files in subdirectories (recursively) Hint: Use ls –R for
listing and wc for counting

3. Write a shell script StudentID_Lab2_3.sh that will take directory path as input
and deletes all the empty subdirectories

4. Write a shell script StudentID_Lab2_4.sh that will take text file as input and
creates a new file by removing all the duplicate lines (or identical lines). Assume
that the input file is not sorted. Use at least one function in your implementation.

Submission:
StudentID_Lab2.zip with total 8 files (4 shell script file + 4 captured output text
files)

You might also like