Lab Assignment, Exams, Universities, Lab Work
Lab Assignment, Exams, Universities, Lab Work
3. Write a shell script fsize that can take multiple file names as its argument and display their
size in the following format:
File name Size in byte
file1 24
4. Write a shell script nvcat that will display a message to enter a filename and then display
the content of the file in the following format:
Filename: File1
...................
.....................
Then it will display another message “Do you want to display another file 1/0”.
According to the entered choice it will display a message to enter a filename and then
display the content of the file otherwise exit. The process will continue till choice entered
is 1. [Implement it using while loop and then using until loop]
5. Write a shell script which will received any number of filenames as arguments. The shell
script should check whether every argument supplied is a file or a directory. If it is a
directory it should be appropriately reported. If it is a filename then name of the files as
well as the number of lines present in it should be reported.
6. Write a shell script dfile2 that will display the name of all directories and non-executable
files present in the current working directory.
7. Write a shell script which displays a list of all files present in the current working
directory to which you have read, write and execute permission.
8. Write a shell script nvcp that will receive multiple file names as arguments. If even
number of files are supplied then the first file should get copied to the second file, the third
file should get copied to fourth file and so on. If odd numbers of files are supplied then no
copying should take place and an error message should be displayed.
9. Write a shell script which will receive any number of filenames as arguments. The shell
script should check whether such files already exist. If they do, then it should be reported.
If these file do not exist then check if a sub directory called mydir exists in the current
directory. If it doesn’t exist then it should be created and in it the files supplied as
arguments should get created. If mydir already exists then it should be reported along
with the number of files that are currently present in mydir.