0% found this document useful (0 votes)
36 views2 pages

Assignment 2 - Answer Sheet.V1

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)
36 views2 pages

Assignment 2 - Answer Sheet.V1

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/ 2

Assignment

Course Code: COMP10024


Course Name: Fundamentals of UNIX
Assignment: Assignment 2 – Shell Scripts (At Home)

Materials and Resources


Publisher
N/A
Materials:
Software: Brightspace, Linux, and Microsoft Word
Websites: N/A
Videos: N/A
Other: Chapter 4, pages 60-98, Introduction to Linux Administration by Jason W. Eckert
(2021)

Assignment Answer
Shell Script
Line # Command Purpose Further Explanation
1 #!/bin/bash Execution of script Shebang line indicates that the
script should be executed using
Bash shell.

2 Create_directory() Function Name given to a function


3 Local directory_name=$1 Local variable Declares a local variable and
assigns the first argument.

4 If[! -d “$directory_name”] Checks the existence of This command see whether


directory directory exist or not.

5 mkdir Create directory It creates the directory if does not


exist before.

6 echo Display a line of text It is used to print the text written


between quotes.

7 fi Ends the if-else block Ends the if-else chain.

8 First_name, last_name variable Set values of variable

9 Create_directory” Function calling Calls the create_directory


$directory_name” function with constructed

COMP10024_Assignment 2_ Shell Scripts Version 1 Page 1 of 2


directory name.

Screenshot

COMP10024_Assignment 2_ Shell Scripts Version 1 Page 2 of 2

You might also like