Beruflich Dokumente
Kultur Dokumente
1 Write a shell script to print the users logged in, the current 01
date and the calendar for the year 2010.
2 Write a shell script to check the present working directory, 03
then make a directory on that location, then create 3 files in it
and give executable permissions to them.
3 Write a shell script to take input for name, course and 05
university and print it in the format – I [name] study in
[course] from [university].
4 Write a shell script which creates one hard link and two soft 06
links of a file.
5 Write a shell script that accepts two filenames and your script 08
should copy file1 to file2 and display both the files. (take
input from keyboard and command line both).
6 Write a shell script that accepts four filenames f1, f2, f3 and 10
f4 and display them in the order f3, f1, f4 and f2. ( take input
from keyboard and command line both).
7 Write a shell script that accepts input as 1, 2, 3, 4, and 5 and 12
display in the order 5, 3, 4, 2, 1.
8 Write a shell script that should accept the output of the 13
current date and print the output in the form – 2009 Oct Tue.
9 Write a shell script that will display the files of the current 14
directory and number of files through positional arguments.
40 Write a shell script that will create 84 users along with their 55
passwords.
Q1 Create a file f1. Create 2 hard links of f1 as f2 and f3. Check ls –l. Add contents in
f3 and display f1 and f3. Delete from f2 and check the contents of f1 and f2. Create two
more hard links of f1, i.e., f4 and f5. Check ls –l. Delete f3. Check ls –l. Display f1.
Delete f5. Check ls –l.
Q2 Create a file a1. Enter 4-5 lines in it. Check ls –li. Note down the inode no.,
permissions, links and size. Create 2 more hard links of a1, i.e., a2 and a3. Check ls –
li and again check the inode no., permissions, size, no. of links. Display a1, a2, a3. Add
contents in a3. Check the size of a1, a2, a3. Delete the contents of a2. Display a1, a2, a3.
Check contents, size, no. of links, permissions, inode no. Change the permissions of a3.
Check ls –l. Check contents, size, links, permissions, inode no. of a1, a2, a3. Delete f3.
Check size, links, permissions, inode number again.
Shell scripts:
Q1 Write a shell script which asks your name, age, department, course and then display
all your information in the given format:
I am ____, studying in ____ belongs to ____ department. My age is ____.
Q2 Write a Shell Sript which asks your enrollment number, names of 3 subjects and
marks obtained. Display the information in the format you want.
Q3 Write a shell script that declares 5 variables. Assign values to them, e.g., a1=20,
a2=15, etc. and then display the values in the given order: 1,5,2,4,3
Q2 Cursor position is at second line. Execute who command. Output must be displayed
after third line.
Q3 Go to 5th line, go temporarily to the shell and execute date command and then again
come back to vi editor.
/
|
usr
|
MCA5
------------------------------|------------------------
| |
MCA5A MCA5B
| |
---------------------------------------- -----------------
| | | | | |
file1 file2 d1 d2 d51 d52
| | |
d11 ----------------- -----------------
| | | | | |
d12 f3 f4 f5 d511 d512
| |
d13 -----------------
| | |
d14 f511 f512
|
-----------------
| |
f33 f44
b) Write absolute and relative path of the files f11 and f512. Your
current directory is MCA5B.