Lab 3 - File Management - v2
Lab 3 - File Management - v2
Name : Marks
Student :
ID
Section :
1. Type the following commands using a text editor and save it as a yourname.sh
(Example: ahmad.sh).
a) Execute the script and draw a tree structure that contains created directories and
files. The parent node of the directory begin with $HOME directory.
[4 marks]
$HOME
b) Write an interactive bash script that will read a type of file extension, display all
those files, and count the number of files. To validate your script, display c
program files, and enter “c” as the input to the bash script. [4 marks]
2. The following Figure 1 illustrates a tree structure of some directories and files.
$HOM
FCS FBE
- dean - Project_Manager
- deputy_dean
Figure 1
Lab 3 (FILE MANAGEMENT) |3
a) Write a bash script (called myname2a.sh) that will produce directories and
files as in Figure 1. Each text files contain its filename without the underscore
character. For example: text file Project_Manager contains Project
Manager). [4 marks]
b) Complete the following table by writing the access control of directories or files
that were produced. Given is the access control for directory called book.
[2 marks]
c) Write another bash script (called myname2c.sh) that will change the access
control of the directories and files based on the following information:
[4 marks]
Users
Directory/File
Owner Group Public
subjects ! ! ! ! x x ! x x
Best_of_software_engineering ! x ! x ! x x x x
FCS ! ! x x x x ! ! !
project_manager x x x x ! ! x x !
d) Complete the following table by writing the access control for each directory or
file after executing the bash script in question 2(c)). [2 marks]
End of Lab 3