UNIX Lab Assignment 5
UNIX Lab Assignment 5
1. Write a shell script to find out whether a given number is Even or Odd.
2. Write a shell script to find out whether a given number is Prime or Not.
3. Write a shell script to produce the Sum of the following Series as well as to print the series:
a) 1+ 2+ 3+ . . . . . . . + n
b) 1+ 3+ 5+ . . . . . . . .+ n
4. Write a shell script to find out Reverse of a Given Number.
5. Write a shell script to find out Sum of the Digits of a Given Number.
8. Write a menu driven shell program which accepts values from 1 to 5 and performs actions depending
upon the number keyed in :
10. Write a shell script that will lists the files whose names are started with Vowels in the current working
directory.
11. Write a shell script that accept a file name and find if a given file is an Ordinary File or a Directory File
otherwise it will give an error message that file not present. If the given file is an Ordinary file it
displays the content of that file.
12. Write a shell script that accept a File name and a Directory name from the user and then check both
the file and Directory exist in the current location. If they do then the file has to be copied to the
specified Directory, Otherwise it will give an error message that the File and/or Directory not present.
13. Write a shell script that accept two File names and will check if the given files are same or not. If the
Files are same then it will Remove the 2nd File otherwise it will display the content of both files.
14. Write a shell script that accepts a Username and will check if it is present or not from /etc/passwd file.
If the user present give the details like Full username, login name, home directory etc.