Vous êtes sur la page 1sur 3

Unix/Linux Shell Programming Lab Practice

Course Title : Unix/Linux Shell Programming Lab Course Code 18CM-606P(A)


Practice

Semester VI Course Group Core


Teaching Scheme in 1:0:2 Credits 1.5
Periods(L:T:P)
Methodology Lecture + Practical Total Contact Hours : 45Pds
CIE 60 Marks SEE 40 Marks

Pre requisites:

Basic knowledge of Unix/Linux commands

Course Content

Unit Unit Name Periods


Number
1 Uses of shell script, Shell special characters, 5
comments, command separator, escaping, quoting
command substitution.
2 shell script, Shell identifiers, Shell variables, 8
Destroying a variable, arrays, Positional parameters
& command line arguments.
3 Evaluating expressions, Text formatting with echo 10
,Arithmetic, relational and logical operators, file
operators
4 If..fi, if..else...fi, if..elif...else...fi, case, 10
5 Loops: for, while, until, select ; functions 12
Total 45

Course outcomes

On successful completion of course, the students will be able to attain below Course Outcomes (CO):
Course Outcome CL Linked PO Teaching
Periods
CO1 Realizes the importance of shell programming and learns R,U 2,3,4,8,10 5
comments and special characters
CO2 Write small shell program using variables, arrays, command R,U,A 2,3,4,8,10 8
line arguments
CO3 Write shell programs using arithmetic, logical, file operators R,U,A 2,3,4,8,10 10
CO4 Write shell programs using decision making statements R,U,A 2,3,4,8,10 10
CO5 Write shell programs using loops and functions to solve R,U,A 2,3,4,8,10 12
mathematical problems
Total 45
Sessions
Legends: R = Remember U= Understand; A= Apply and above levels (Bloom’s revised taxonomy)
Course-PO Attainment Matrix

Course Program Outcomes


PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10
Unix/Linux Shell - 3 3 3 - - - 3 - 3
Programming Lab
Practice

Level 3- Highly Addressed, Level 2-Moderately Addressed, Level 1-Low Addressed.


Introduction to shell programming.
 Introduction, Uses of shell script, Shell special characters, comments,
command separator, escaping, quoting command substitution.
 Creating shell script, Shell identifiers, Shell variables, Destroying a
Variable, Positional parameters & command line arguments.
 Evaluating expressions, Text formatting with echo
 Arithmetic, relational and logical operators, file operators
Shell control structures
 If..fi, if..else...fi, if..elif...else...fi, case,
 Loops: for, while, until,
Functions

List of Experiments

1. Write a shell script to display current date, time, username and directory.
2. Write script to determine whether given file exist or not, file name is supplied as
Command line argument, also check for sufficient number of command line argument
3. Write a shell script that uses special variables related to a command line
4. Write a shell script to access the array values
5. Write shell script to show various system configuration like:
a) Currently logged user name and his long name
b) Current shell
c) Your home directory
6. Write shell script to show various system configuration like:
a) Your operating system type
b) Your current path setting
c) Your current working directory
d) Show all available shells
7. Write a Shell script to accept any two file names and check their file permissions.
8. Write a Shell script to read a file name and change the existing file permissions.
9. Write a shell script to read a file name and check if it is a directory or block special file or
character special file
10. Write a shell script to print current month calendar and to replace the current day number
by ‘*’or ‘**’ respectively.
11. Write a shell program to illustrate command substitution.
12. Write a shell script to print all Arguments with script name and total number of arguments
passed
13. Write a shell script to access command line arguments by shifting position
14. Write a shell script to read two numbers and perform arithmetic operations
15. Write a shell script to read two numbers and check their relation using relational operators
16. Write a shell script to read two numbers and apply Boolean operators( logical AND,OR and
negation) on them
17. Write a shell script to read two strings and check whether the two strings equal or not
18. Write a shell program to print the sum of first n natural numbers
19. Write a shell program to check if the read number is Armstrong number or not
20. Write a shell program to factorial of a given number using for loop
21. Write a shell program to demonstrate select loop and case
22. Write a shell program to print the following output using nested loops
11111
22222
33333
44444
23. Write a shell program to demonstrate the use of break and continue
24. Write a shell program to demonstrate command substitution
25. Write a shell program to illustrate pass parameters to a function
26. Write a shell program to return values from a function

Reference

1. “UNIX - Concepts and Applications”, Sumitabha Das 4th Edition, Tata McGraw Hill,
2006.
2. http://www.freeos.com/guides/lsst/
3. http://heather.cs.ucdavis.edu/~matloff/Linux/LinuxInstall.pdf (Chapter 1, Linux
Installation).
4. http://docs.fedoraproject.org/en-US/Fedora/20/pdf/Installation_Guide/Fedora-20-
Installation_Guide-en-US.pdf.
5. https://www.linuxnix.com

Vous aimerez peut-être aussi