Unix and Shell Programming - Dec 2014
Computer Science Engg. (Semester 4)
TOTAL MARKS: 100
TOTAL TIME: 3 HOURS (1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks. 1 (a) Define briefly the UNIX architecture explaining the role played by the kernel and shell in sharing the work load.(8 marks) 1 (b) Draw the tree structure of the file system created by the following commands (assume you are in the directory / usr / office). Why is it not possible to issue the command rmdir / usr / office / right.
$ mkdir left \ltbr\gt $ mkdir middle
$ mkdir right \ltbr\gt $ cd left
$ mkdir left middle right \ltbr\gt $ cd ../middle
$ mkdir dir1 dir2/usr/office/right/dir3(8 marks) 1 (c) Explain the concept of absolute path name and relative pathname.(4 marks) 2 (a) Which command is used for listing file attributed? Explain briefly the significance of each field of the output.(6 marks) 2 (b) Assuming that a file's current permission are rwx r_ _ r_x, specify the chmod expression required to change them to:
i) rwx rwx r_x
ii) r_x r_x _ _ x
iii) _ _ _ r_ _ r_ x
iv) _ _ _ rw_ r_ _,
using both relative and absolute methods of assigning permissions.(8 marks) 2 (c) Explain the three modes of vi and explain how you can switch from one mode to another.(6 marks) 3 (a) Explain the three sources of standard input and standard output.(6 marks) 3 (b) Explain what these wild-card pattern match:
iv) *[!s] [!h](8 marks) 3 (c) What is a process? Mention briefly the role of fork-exec mechanism in process creation.(6 marks) 4 (a) What are hard links? Explain two application areas of hard-links. What are the two main disadvantages of the hard-link?(6 marks) 4 (b) Explain these commands with examples:
ii) touch(6 marks) 4 (c) Explain the following commands:
tr.(8 marks) 5 (a) Explain the grep command with options.(8 marks) 5 (b) What is sed? Explain addressing in sed, with suitable examples.(8 marks) 5 (c) Explain the anchoring characters.(4 marks) 6 (a) Explain the special parameters used by the shell.(6 marks) 6 (b) What is shell script? Explain the following statements with syntax and examples;
iii) while(10 marks) 6 (c) What is the 'exit' status of command and where is it stores?(4 marks) 7 (a) Explain awk's build-in variables.(6 marks) 7 (b) Write a program in awk to store the totals of the basic pay, da, hra and gross pay of the sales and marketing people.(6 marks) 7 (c) Briefly describe the built-in functions in awk, with examples(8 marks) 8 (a) Write a Perl script to determine whether the given year is leap year or not.(7 marks) 8 (b) Write a Perl script to convert decimal number to binary.(7 marks) 8 (c) Explain variables and operations in Perl.(6 marks)