MCA 307: Unix Shell Programming Lab

Lectures: 6 Periods/Week Sessional Marks: 30
University Exam: 3 Hours University Examination Marks: 70


UNIT-I
Lab Cycle

  1. Write a shell script to accept two numbers and perform all arithmetic operations on it.
  2. Write a shell script to find largest of three numbers using conditional execution operators.
  3. Write a shell script to check whether a particular user has logged in or not. If he has logged in, also check whether he has eligibility to receive a message or not.
  4. Write a shell script to accept the name of the file from standard input and perform the following tests on it
    1. File executable
    2. File readable
    3. File writable
    4. Both readable & writable
  5. Write a shell script which will display the username and terminal name who login recently in to the unix system.
  6. Write a shell script to find no. of files in a directory.
  7. Write a shell script to print the following format.
  8. 1
    12
    123
    1234
  9. Write a shell script to print prime numbers up to a given range using arguments.
  10. Write a shell script which will display the number of days in the given month and year.
  11. Write a shell script to check whether a given number is perfect or not.
  12. Write a menu driven shell script to copy, edit, rename and delete a file.
  13. Write a shell script for concatenation of two strings.
  14. Write a shell script which will display Fibonacci series up to a given number of argument.
  15. Write a shell script to accept student number, name, marks in 5 subjects. Find total, average and grade. Display the result of student and store in a file called stu.dat.
    Rules: avg>=80 then grade A
    Avg<80&&Avg>=70 then grade B
    Avg<70&&Avg>=60 then grade C
    Avg<60&&Avg>=50 then grade D
    Avg<50&&Avg>=40 then grade E
    Else grade F
  16. Write a shell script to accept empno,empname,basic. Find DA,HRA,TA,PF using following rules. Display empno, empname, basic, DA,HRA,PF,TA,GROSS SAL and NETSAL. Also store all details in a file called emp.dat
    Rules: HRA is 18% of basic if basic > 5000 otherwise 550
    DA is 35% of basic
    PF is 13% of basic
    IT is 14% of basic
    TA is 10% of basic
  17. Write a shell script to demonstrate break and continue statements.
  18. Write a shell script to satisfy the following menu options.
    1. Display current directory path
    2. Display todays date
    3. Display users who are connected to the unix system
    4. Quit
  19. Write a shell script to delete all files whose size is zero bytes from current directory.
  20. Write a shell script to display string palindrome from given arguments.
  21. Write a shell script which will display Armstrong numbers from given given arguments.
  22. Write a shell script to display reverse numbers from given argument list.
  23. Write a shell script to display factorial value from given argument list.
  24. Write a shell script which will find maximum file size in the given argument list.
  25. Write a shell script which will greet you “Good Morning”, ”Good Afternoon”, “Good Evening’ and “Good Night” according to current time.
  26. Write a shell script which will display total size of directories.
  27. Write a shell script to sort the elements in a array using bubble sort technique.
  28. Write a shell script to find largest element in a array.
  29. Write an awk program for display the lines in any file centre alignment.
  30. Write an awk program to print sum, avg of students marks list.
  31. Write an awk program to display total number of users and their names in unix system.
  32. Write an awk program to display students pass/fail report.
  33. Write an awk program to count the no. of vowels in a given file.
  34. Write an awk program which will find maximum word and its length in the given input File.
  35. Write a shell script to generate the mathematical tables.
  36. Write a shell script to check whether given number is strong or not.
  37. Write a shell script to sort elements of given array by using selection sort.
  38. Write a shell script to search given number using binary search.
  39. Write a shell script to find number of vowels, consonants, numbers, white spaces and special characters in a given string.
  40. Write a shell script to lock the terminal.
  41. Write a shell script which merge the contents of file1, file2, file3, sort them and display the sorted output on the screen page by page.