Sie sind auf Seite 1von 5

# 1. Write a Shell script to display Prime numbers in a given range 2.

Write a shell script that computes the gross salary of a employee according to the following rules a) if basic salary is < 1500 then HRA=10% of the basic salary and DA=90% of basic b) if basic salary is >=1500 then HRA=Rs 500 and DA=98% of basic The basic salary is entered interactively through the keyboard 3. Write a shell script that accepts two integers as its arguments and computes the value of first number raised to the power of the second number. 4. Write an interactive shell program for copying, removing, renaming a given file as input. 5. Write a shell script that takes a login name as command line argument and reports when that person logs in. 6. Write a shell script which receives two file names as arguments. It should check whether the two file contents are same or not. If they are same then second file Deleted. 7. Write a shell script to generate a multiplication table 8. Write a shell program to do the Arithmetic Operations like Addition, Subtraction, Multiplication, Division. 9. Write a Shell program to do the following operations (i) Create a directory (ii) View all files in the current directory (iii) Rename a directory (iv) View all files starting with a specific character (v) View all files and hidden files 10. Write a Shell program to find the largest among n different numbers.

11. Write a Shell program to count the number of digits in a number and also find the sum of the digits of the number. 12. Write a Shell program to print the reverse of a number. Also check whether the given number is palindrome or not. 13. Write a Shell program to generate n Fibonacci series and also the sum of the numbers generated. 14. Write a Shell program to find the largest digit of a number. 15. Write a Shell program to check and display 10 consecutive leap years. 16. Write a Shell program to find the sum of odd and even numbers from a set of numbers. 17. Write a Shell program to find the roots of a quadratic equation. 18. Write a Shell program to check the given number is Armstrong or not.

19. Write a Shell program to find the sum of square of individual digits of a number. 20. Write a Shell program to execute the following UNIX commands (i) Display the calendar (ii) Display the date and time (iii) Display the present working directory (iv) Display your user name (v) Create a file using cat command 21. Write a Shell program to find the smallest number from a set of numbers. 22. Write a Shell program to find the smallest digit from a number.

23. Write a Shell program to find the sum of all numbers between 50 and 100, which are divisible by3 and not divisible by 5 24. Write a Shell program to find the sum of digits of a number until a single digit is obtained. 25. Write a Shell program to find the second highest number from a set of numbers. 26. Write a Shell program to execute the following UNIX commands (i) Create two files (ii) Combine the two files into a third file (iii) Search a specific file from a directory (iv) Display the common and distinct line of content from a file 27. Write a Shell program to find the sum of odd numbers and even numbers from a number. 28. Write a Shell script which displays Good morning, Good afternoon or Good evening, on the monitor, depending on the time of running the script. 29. Write a Shell script which reads a number in units of seconds and converts it to the units hours:minutes:seconds and prints the result to standard output. Your script must prompt for re-input if a negative value is given. Enter number of seconds: 12345 Result: 12345 seconds in hours:minutes:seconds is 3:25:45 30. Write a Shell script which takes year as an input and displays whether it is leap year or not. If year is not provided then take current year as an input. 31. Write a shell script to display the digits which are in odd position in a given 5 digit number. 32. Write a shell program to concatenate two strings and find the length of the resultant string.

33. Write a shell program to exchange the values of two variables without using temporary variable. 34. Write a shell script to find the sum, the average and the product of the four integers entered.

## 42. Write a Shell program to find nCr.

35. Write a shell script to check whether the given input is a number or a character or a special character.

36. Write a Shell script to execute the following UNIX commands (i) Create a directory with the name of Exam (ii) Change the Exam directory as the working directory (iii) Create a file called exam.txt in the Exam directory (iv)View the content of the exam.txt file (v) Rename the file exam.txt to test.txt 37. Write a Shell script to execute the following UNIX commands (i) Create two files (ii) Display the content of both the file (iii) Count the number of characters of both the files (iv) Rename the two files (v) Combine the two files into a third file. 38. Write a shell program to read a file name and check whether the file is an ordinary file or directory. If ordinary file then check whether the file is writable. 39. Write a Shell program to find the maximum and its position among n single digit numbers.

## 41. Write a Shell program to find n! / r!

40. Write a Shell script to read Old meter reading, current meter reading and prepare an EB bill for the following tariff rates. Tariff- Units 1-100 101-300 300-600 Above 600 Amount 1.00 2.00 3.50 4.50

43. Write a shell script for following i) decimal to binary ii) count all hidden files in a current working directory 44. Write a shell script to check whether given argument is directory or file. If it is a file, print the number of line present in the file.

45. Write a shell script to find how many days remaining in a current year.