CS16 - UNIX SHELL PROGRAMMING

CS16 UNIX Shell Programming

 

Teaching Hours : 60  [ 30 hours Theory + 30 hours LAB ]

Prerequisite: Basic Computer Knowledge.

 

Unit 1

Unix Architecture and Command Usage                                       
Introduction to Unix OS, The UNIX Architecture, Features of UNIX, General purpose utilities.

The File system                                  

File, filename, parent-child relationship, directory related commands.  The UNIX file system, File related commands, Compression and archiving files-zip and tar.

(6 hours)

Unit – 2  File Permissions and Attributes

File ownership, file permissions, chmod, directory permissions, changing file ownership, mask, Pr, head, tail, cut, paste, sort, uniq, tr, grep, egrep, sed

(6 hours)

Unit-3 The vi Editor

Vi basics, Input mode, ex mode, navigation, editing text, undo, repeat, search, substitution

Shell, pattern matching, escaping and quoting, redirection, special files, pipe, command substitution, shell variables, environment variables, aliases, command history, in-line command editing.

(6 hours)

Unit –4 Shell Programming

Shell scripts, Shell variables, Shell keywords, Assigning values to variables, UNIX-defined variables, unchanging variables, wiping out variables, positional parameters, command line arguments, shift, arithmetic in shell script.

(6 hours)

Unit- 5 Systems programming

Decision Making: if statements, test command: File tests, String tests, Numerical tests, Logical tests, nested if, forms of if.

Loop Control Structure and shell metacharacters:  while loop, until loop, for loop, nesting of loops, break, continue, shell meta characters.

(6 hours)

Text Book

1.      Yashavant Kanetkar, UNIX shell programming ,BPB publications

 

Reference Books

1.      Sumitabha Das, UNIX Concepts and Applications, Fourth Edition, The McGraw-Hill Companies

 Lab Programs

 

1.      Write a shell script to execute the basics arithmetic operations.

2.      Write a menu driven shell script to execute the following commands: cat, touch, cal, time, date.

3.      Write a shell script to generate the sequence of even numbers.

4.      Write a shell script to generate the series. 1, 4, 9, 16, etc.

5.      Create a directory and few files with in it of your choice. Write a Schell script to perform the following operations. Copy one file from your directory to any other directory. Append few lines in any of the files in your directory. Delete any file from the directory.

6.      Write a shell program for creating a file that contains records with a delimiter. Sort this by considering any one field as the primary key.

7.      Write a script to encrypt and decrypt a text file.

8.      Write a shell script to perform the following string operations: Find the length of the given string and extract a sub string from a given string.

9.      Write a shell script that takes a command line argument and demonstrates various file tests. (Write a shell script which will report whether a given argument is a directory or a file.)

10.  Write a shell script to find whether the given number is Prime number or not.

11.  Write a shell script to find whether the given number is an Armstrong number or not.

12.  Write a shell script to generate the Fibonacci series.

13.  Write a shell script to demonstrate the function call in UNIX.

14.  Write a Shell Script to convert a binary number to its decimal equivalent.

Programmes
Open Electives