You are on page 1of 19

'

lOt ~H -1

10th

Nnh>\ , ,(t♦ ., .. ,.,,, , tll'O' t 1'H 'h'.fUII '-'"'"·~;1ou~, ,h 1 l~.-tl111,1


11l1'-~u .\ f fft 1) tJfi1~'ii/c1,t\l 1)'4Hf l ffi h ' /1 /ltU'i ,

\',\\fl' A
(tit. M•1·\i.11)

(116 M1uk s )

(Oil Ma.-lu,)

fl\r~ ,,11,,'t' 111 ,w,mh111 l,,n~ 111'\' , w ,,, ... ,.


11
l • ch,'"' 1, ,1 lhl' 1\,11,,wl\\~ :
I) r • X
II) l'WX\ W X X
111) 1• X I' X \' X
iv) 1 W X I' W X I' · ,
us hit:, t",ch 1·d,,th1c- 1H1d "h:--,,hl\t, l~t~lh,~11:-t ,,f 11:islji!11in~ l't'l'mis~li""s. (OS M•rka)
\\' tu,1 rll'l' dlfJt-1't'l\l ,n,hl<•s ,,f ,1\.c:-,llh,r'? H:s.plnln wllh t\ nt"Ol lllftgrnm. (06 Marks)
Wrltl' llNI~ r1)1\\llH\lHI ~ I\ H' l.h~ 'th\knvlns :
i) 1•'111 ,1 n11d t'\• ph1('t' l\ll th0 .uo,,11n·l'tWt'S nf nnix with UNIX in tht'I tt,xl ftle ol\cr confuming
th" user ( vi '-'ti Ito,· u~1,,mun~I).
II) List :lll 1hc Ilk~ '" l'\VD whil.\h tn'l' htwlnp. vXt\C-t ly l1\'e dmmctcrs in their filennmc und
rm,y 11111n\,cr .t)f ~hurrh.: tc:-rs in thdr ",~tonsh,n
Iii) 'I\) l·npy 1\ll lilt's sto1't',I In /111.., mt'/vtu with •c . •cipp nml ·jnvn extensions to p_rogs
dirc'l'lqry ·r n 1,,'\ll'rt•l\t ,llt~~tMy
Iv) Tn ,lolt1tc ,,II
lllC's \.',,n111inh\W, + ln thtllr lit¢ rnmu.,
v) ro tl<'k' l'-' nil ntc~ with llu~c dunMtor cixl~nsi1>n oxct:1pl •nut lhm, current uircclOry
vi) ·ro,tisplny ( list) cn ntl'l\ls of@ncnl diro1.,1"'')' 01,,I its suhdlrel.)tories. (06 Murk!I)

J a. £xpl:,iu :l shmdnnt 11lcs supp,,rtcll hy UNIX . Alsn p,ivo llorni\s nbout special fi\~s used for
output rcdlrc~tion in l lNIX . (08 Marks)
h. P.x.pluin mc:-i:-h:rni:m, <'f pn,"'1:.'ss a1..·1,ti,,n. Also l)_iv~n lktni\s nhout proce~~ stf\tcs llnd
,.,)mbics. (OS \\larks)
1.: . Explnin folhnvin~ with \'.IX:unplc~ :
i) c.r,m ii) 1101\ 11 •: iii) Pt\TH iv) MA\L (04 Marks)

•• a. i) nim.-..(~l\tintc.· hctwc-tm hord link 111\d S)lll\hllliC link


ii) Expl:tin signifi1.'. :\lll'.t~ of 1wrmis~ions to di~ctory . \OS Marks)
h. Whlll do1,,~s h)ud, fon ~(.Hunumd l\\l'nn? \Vhy tot;t~h l~,,mm1'nd 1s iml''-'r\1mt for the system
ndministrntor? • (Ob Mark~)
c. Explain the folh.)winl', with t~xnmpk ;
i) hl•aJ ii) tuil iii) c ut . (06 \\larks)

:u.:Mssct:-r. LIUHAr~v, rn.L/\G/\v,


l0C S44

J'AUT H
I,{
I 4 'J/ nJ, riv: }11. Jp {Jf t /.J1.11J(J k (:;,-..p bt,n yvp Virnmand and Ji1>'1 its u p-t ions wit h the ir s ig ni ficance _
(08 Ma.Jk.i)
l ~/,f) lbfo Ji,;_,., ltM rt✓'v(~ i ne ant1 ,..,)f1u~xt a4dres~ing in s.ed with ex.amp le. (06 M~~
I, Hr~ N / ,. 7..µJJ:.1,, 1111~1y;,I rc;,p l:,I 1;;qiress.on and tagged regu lar express io n. (~ M.•l'ls)
.,. . ( /
I; l ~,-,{ 1IA111 ::.l~II t'J;nL,m ::-:. I)( y;t; il.e and for with syn.tax . • · y . (o·s Marks)
'1/l;;,1 fo ic½ rl ~~111,JJ~ r 1 f a (..,)mtr)JU')d and where it is stored? And ho w rt can be a~cessed? Give
t;.L1;1r'-11J,,;t; . {(', (06 Marks)
Wr;11, n t,/1,f;lt v;dr, t,(J ~pt a string from the term ina l and d isp lay,•-sQ°'rta& Je message if it
11, ~JJ ' f ,~ Y'v a.t k ~ Jr; chMat:.,1-ers using : i) case ii) expr. I'. , •••.; (06 Maf'\s)
V ✓- .

'I r,, Wt,;;1 k A, WY,.? l.i;,;pktin .any three b1Ji lt in function.s of A WK. (.):; (08 Marks)
1; '1/lf'AJ. ~It ,:;#;/J-<:faJ.i V<; 11.rra.ys? How tht,-y ~re implemented !~ ~WK? (06 Marits)
I ,
WJth ::. 1m.ax uv1 t;;,.JjmpLe-s, e.Y,.plain control flow statements)n A WK. (06 Marti.s)

~ :,,. J~/,,P/H_in M 'J thf";<; string fw.ndling C-Unctions in Perl


(~2f (06 Man.s)
1--J W°A h ~ JiJ;;hJJt ,;x.amplc~ <:r..pl.E.in ~pJit and join ~yons in Perl. (06 Man.s)
1,
'//r',,J:!; 11. J1trl pmgrw-n that prompts the user to)ry,ut string and a number and prints the string
t1Yn,r, Jfi1'41:J tim.1;~ r,n t1 ifft rt:nt l.if1f;:s to stang.ar<t output. (08 Marks)
.r
-
~~~"l~
-- - _III-- \ -, -, -, •~<~v~
f l J
:- : I -,rt,inl ---n o • ·
scn1cstc1· . E·. cg1ec •., · ·
c.xa1n111ahon? l> e <.~. 201(,/.h,n . 2 0l7
UNIX and Shell Programming

M a.A M :.,r~ , lH J
•. • hr:. -
ittl' · •
['l,,u.·: An.~u-er FIVE full questions, clwosin,: unefu/1 question from ea c h modul, .

Mollulc- 1
Discuss the; salient _features of UNIX Operating syst em. (f)'> Muk•)
:1. f:q,lain the fo !!o) w(mg c~!~11) nanhds with examples :
t,. i) echo > u , .s 111 w o_ iv) date ._ (&4' M.a,,u-,
Writ~ a not e: on man documentation and explain the keyword option and w hat is option'!
C- ((>{, M 1r u1o )

OR
Explain how to display and set the terminal characteristics of a UNlX OS . (06 ~:i.r1u J
2 ll- Exph1 in the contents of /etc/passwd and /etc/shadow file with respect to UN IX O S .
b. (06 Mar1u)
,-:: . £,xplain the commands to add and delete a user. (04 ~:ar1,,.s)

Module-2
Explain the different file types available in UNIX . (06 ~:ark,)
a.
b.
With the help ofa neat diagram, explain the parent child relationship with respect to UN I X
file system. (M M a rk&)
c. Explain the following commands with example
i) HOME . ii) cd iii) pwd iv) mkdir v) nndir. (OS Muk:s)

OR
4 3. Explain the following commands with example :
i) cat ii) mv iii) rm iv) cp v) we. (05 Marlu)
b. Explain the seven field output of ts - t command. (05 Marlu)
C. What are different ways of setting file permissions? (06 Marlu)

Module-3
5 c;l. Explain the different modes of vi editor. (04 Mark,)
b. Explain how the text is entered and replaced in input mode of vi editor . (06 Marlo)
C. Discuss the navigation commands in vi editor with example. (06 Mark,)

OR
6 a. Explain Shell' s interpretive life cycle. (0~ Mark\ )
b. Discuss the three standard files supported by UNIX. Also give details about the special fi\es
used for output redirection in UNIX. (Ob Maril,)
C. With the help of example, explain grep command and list its options with the ir s igniftcanci.: .
(06 \\ar k. , )

Module-4
7 a_ Explain the shell features of " while" and " for" with syntax . (OX '1 arln)
b. Explain with example set and shift commands in UNlX to man,pu\a te-pos it iona \ paramc t C'f'
. {08 '\ hrl...,\
\ of 2

SCET , LIBRARY , BELAGAVI


()l{

s .a. Dukft':Rt.'-~t~ ~ 'h\~'m h;tt'\i link :md :-:,,tl link


h. E¾-·,'\hitl 1h~- t\""lk,,\ i~ with ,-.., ~mpk ,
)) h..'3-J ii) ~ul - iii) ,'\ll iv) j\:l:-1<'
.. _ D&"!l.,._ hri.:·11) ~' r! ,':t.,mm:sl.nd with it:- t'l)li,,n:-,

~Jt.uluk-~
(Cl·I IVl11r1t~)
ll L E~u.n nx\.'.03.ni~n t'f pl\-~\'t~ ,•n-,_1t>t'll.
h. .Expbin th:' tN"-""" in,g "'\°"nun., 1"\J :
.i) s: ii) ,'n"\n iii) nif•i.' i,·) nohup,
..-:.. Exphcm find IX\lllm:md w ith its \lpllt'llS.

OR
16 s. Expls..in ~ following string h.«tndling fon,·tit,ns l)r PERL with 1.'.-xnmpks :
i) length ii) index iii) suhm iv) rt'Vl'.l"St.'- (ll8 M1u"1ti)
h With Sl.tirabk ~.'ta.nl_P)~ e.xpl:tin split :mdjl)lll ti.mc.tilms in Perl. (M l\hrks)
c. faphin fik hsndling in Pe.rl. (04 Morles)
I I I 11 111 I I ..
' l'hlnl Sl•nu·,h·r 1\ . 1· . Ut·l,(Ht' l•.11 1u11111 atlou , ,lum·,., u, , L.*' , 7
Unl>C and Sholl Progran,min g

~.-t .. , ~A~1, ¥-,


l 11 1H' \ ht,,~,\ 111' ",,r :,n y I·'IVI•.' 1·u11 11m·, ti om, r Iioo•
.
u' ni ou c full <1u-tuton rnI m r 4 t h mtJd•"
'1 ll l • •
· ' ~lqd u!e-1
~, ih ti ,,c-n l lln, g_rn,11, np l11111 the nrchtt er lurc of IJn,x opern lm~ ,. ~H. r, f(llf :-.1,.,i. ,
11. \ , I 1hr h1.· lp l, , a d1a gra111, cx ph1111 the paren l child rel.1l1on: hip ,n 1·, ,, t tic <;;y,.ic:m
\VII I
b 104 ~.,1 1 1
. . ,i:nu ihr l1.1 lknv1'.'l'> l'lltl\1rn1111.h; w11h the syntax anti example
l' l·~\ 11 )prtn tl 111 )dn1c 1v) Unnrn~ 114 '\1.u1£ I
1) tl y

OR
. th<.' snh1.·111 fea tures of Unix operating system. ,., 'Vt.trtu l
. \ , X\' h1111 _• ,• , ) , d,
•1 t),ll't·r1.·iilialc \JCIWC\;ll cxrcrna ,an internal co mmands in Unix wit h suitable cxarnpk
), . {04 '\-h,1k1 l
. . ihc following commnnds with synrax and exa mp le :
t· xi' 1,1111 I ...
c ' ii) ~c 10 111) cal iv) pass wd rtM :\t.-t'\ 11
1) sll Y

Modulc-2
_ \lhistrntc with ~ diagram typical Unix file system and expla in different type , of tile~
1
· · suppC1itcdinU111x . . (Oil Mark•)
Name the co111mand used for crcatmg, deleting and changing the dircc1ory Explam wnh tit<'.
ti. 1
synt:tX :ind cxarnp c. (O• l\ltar\. 1 l

OR
a. Which com1nan<l is used for listing file attributes? Explain the significance of each fid d ,n
the output. \0~ ~tarlu}
h. Files current permissions arc rw - · w - r - - write chrnod expressions required to chJ.n~c
them for th~ following. ·
i) r .. r. - - • x ii) rwxrwx · - x iii) r - xr - xr - x iv) rwxrw x.r - -
Using both relative and Absolute methods of assigning permissions. 1011 Mark ~!

Modnle-3
5 ::i . Explnin the three modes of Vi nnd explain how can you switch from one mode to ..i.n<:!hl'r
1~ -l \<!.ul.., I

h. Explain what these wild - card pattern match :


i)(A - Zl???f ii).l!0 - 9]° iii)• · [~Sl(~hl
c. With suitable examples , explain the grcp command and its various option,

OR
C.
\:\.'rire the U · .
i) F .0 dOI.\ co rn ina nds for rhe followin g :
• ' fi a~d re place n il the o ccurre nce s of ·· lJm x .. ' " ith " UNI
ii) T
\.: O n lITilir O 1h
. '~ c user. [Vi editor co,nma ndJ .
x·· in lhc: lc x 1 r 1~
1
d ? oelete all files with three chnractcr e xt e ns io n except " . t"
. .. tre cc o ry_ 0 u fro .
u,) L ist Jl h . 111 to,
a l c files in P\VD which are havmg exac tly fi ve characters · .
and an . tn the, fi
iv W . . Y nurnbers ch~racters in their exrcns1~n. _ r 1Ien,
) ) ntu~g the first 50 Imes to another file. fV, edit o r comma nd].
v_ lnsertmg a text at the beginning of the line . [V i editor comma nd) .
v i) SearcJ1ing for a pattern in backward direction. .
(06 l\iJ;i
7 a. \Vha . Module-4
. l JS shell programming? Write a sheJJ program to create a menu and execurc _
?PtJ_?ns based on users choice. Options include a g,-
!) Li st of users ii) List of processes iii) List of files
iv) C~rrent date v) Content of files vi) Display current login users.
b.
Explam the following with an example: i) head ii) tail iii) cut. 00 1\lfar.
(06 ~l:ir
OR
8 a. \Vhar is shell script? Explain the following statements with syntax and example :
i) if ii) case i1i) while.
b. Distinguish between hard Jinks and soft Jinks with suitable example. 00 l'ttari
(06 Man

Module-5
9 a. Write a Perl script to determine whether the given year is a Jesp year 01 ·not.
(1}8 Matt.
b. Explain the mechanisms of process creation.
(06 Marie
C. \Vhat is an associative array? (02 Marki

OR
10 a. Explain the following in PERL with example. i) Split iii) Join. (08 Marks;
b. Explain variables and operators in PERL. (06 Marks)
C. Briefly explain the subroutines in PERL. (02 Marks)

2 of2
' II' / I I I
I\, l l lh ~ ~,h II . . , I 11 I , , 1\.11 ,11 1 111•1 11, ,, \\ •\\ 'Il l 1111111 11111 ,1 ,111 II '
11p1 'u 1 11 ► 111111 11 ,
\\I'' 1\, \\h' II I ,11\d .\ Ilk 1111d '. \ 1111 h h •I 1111 \ hi\ \, Ill 1\1 111, !I ii
1\1 1111
t \h, -.. h, It '1 Iii\ l, 1,111 }, I\ 11\t\ 111, \ h i. I Ith ol \1 \ \\ 1 \ l 11 1 Iii, II ii
' 1'~1\1 11111 11,, 11, I
" 1lh ' .\ 111\' \\II d, l\ \11\ ) l\1•11 ,, 111,1 "' \h- \ \l 111\ 1l1i h1ll,11, ltlj i 11h111,i , 1 I
1\ I,~,
111 I\.>\ 1:i- \\ h\\ I\\ \' ~'H\l\'II \11
it\ 1 1)1 ,,, t1k- , m th,11 1111, 111 11 11 \ ,1 11 , 11
11\) t ~ I 1\1 \ \i i i, 1..i.. ll.1' '1\ 111 lll\1 1
1, \ \\,,I,\.\ , d ,1111
\ ) \ ~\ii\ h \ l 1NI \
lllll l'l !l tl1»I
'I
l\·,q \l'• llh' '' " ~ 11\111, \\ 1t h '-1 \ 11\ 11\ 11\\d 1,, ,q1 111 h1
11111 1 t l lt ,11 1 1, 1111 11\'ll 111 11 1,111111111 11 111 ,,,
,,, ,, , \~\',\ 111 m,,-><I l'" 't: 1111\111111\ll l,111i111,1111 i."
h l'. \~'"'h' ~~,, 1'~\j\\1\1\ ,·,11\ i. l\ lh' \ ll ~"l'l''ll \\
n,..., tt,
ti\ \ I, \I "' , \
J_,,,,,t\,1 11\,, b1uh 111 l\11111h111-. ~up p,1111 ,,I In ,m t, 111 1111 \II UlHVli,
11111 l\ li11 1i ~1
11111 i' h11 lr1t f
,11 11 1111, 11 111111n 1,11 1,, 11 ,
1 1
(1111 1\1 ,If " ~l
s \\' nh ,"\ ., 11 ,ph1., , ,\,,\~\~\ 1lh\ " ' ' " ' •~ h11111l111111 1111 \1 , h 111J11 .!l tq ,p11H1·d 111 1n ti
tllO IH11 1!1~j
t '''" " " ' >1,\n ,111.I 1,,h\ "•' ,I '" I'• 1 I :,1, 1111 ~ 1
\\~''" ., ,~.,,,.,.,.,i,,, "' 1
,f,·le1, 1\\11\11 "h111h~1, 11 \ 1'1\1 11' h:,,t1\~U111 tll 1111 1
tlt u l\ 1111 11~)
111 11 IH,111t -}
\ I
l
. _ _fJ .
usN OJTIIlD- . n r
l)cgrce
'""'"ninnhon, l>cc.2014/,lan . 2015
F irtb Scnicst.cr ••· ~- d shell programming
-
I OC'-44

m UNIX an
Max M ark \ . \ ()()
L"JVE full qiwstions, ye/ecting
.Jime: 3 hrs. Note: A nswer
. ., rwo
J. •
questwns firotn eac I I part.
at/eas
PAR'f -- A

·· . UNlX architecture explaining the role played by the keme\ and shc\1 in
a. oes~r~be briefly t!:ad. . ( 08 '1arks)
shan.ng th~ work turc of the fl\e system created by the fol\owmg commands (assume you
b . Draw_the ·ht.ree ~~:~tory/usr/office). Why is it not possible- to issue the command
are in l c ... ' .
rmdir/usr/o ffice/t1ght.
$ mkdir left r

$ mkdir middle
$ mkdir right
$ cd left . .
$ mkdir left nuddlc nght
$ cd ··/middle .·
$ mkdir dir l dir2/usr/officc/right/dir}, : .·. (08 Marks)
c. Explain the concept of abso\ute pa_t~ ri~n1f a.!ld relative pathname. (04 Marks)

a. Which command is used for listing file attribut~s? Explain briefly the significance of each
2
field of the output. . . (06 Marin)
b. Assuming that a file's cur,r~t permissions are r w x ;··- - r - x, specify the chmod expression
required to change them_:to : _
i) r w x r w x r -.Ji·:.:= -
ii) r - xr-x ~~~ x. '
iii) - - - r -: ~·-r ..:_ x
iv) - - - r 'w :_ r - -,
using bo)h relative and absolute methods of assigning permissions. (08 Muks)
c. Expl~ii1: the three modes of vi and explain how you can switch from one mode to another .
· i -, (06 Muk,)

3 a. . J;:xplain the three sources of standard input and standard output. (_06 Mark!,)
b. Explain what these wild - card patterns match :
i) [A- Zl??'??*
ii) *(0 - 91*
iii) *L'° - 91
iv) *•(is) (!h]. (08 \hru)
c. What is a process? Mention briefly the role of fork - exec mechanism in process creation.
(06 ~hrks)

a. What are hard-links? Explain two app\ication areas of har<l-\inks. What are the two main
disadvantages of the hard-link? (06 M arks)
b. Explain these commands with examples·. i) umask ii) touch . {06 Marks )
c. Exp\ain the fo\\owing commands :
i) pr ii) tai\ iii) sort iv) tr. (08 ~lark~)
\ of2

,!\Assen, LIBRARY BELJ\GJ\VI


1
PAHT B

5 a. Exp bin rlw gn.'p Cl) rtunaml with oplil111s.


b. Wh:H is setf ? Exp la in aJdrcssing in sc.:d, with suitab le cxn mples
C. Ex plai n lht: anchoring characters.

6 a. Exp lain the special pnrnmetcrs used by the shell .


b. What is shell script? Explain the following stateme nt s w ith synl.n x and exa mples . (06 ~, ~r\t)
i) if , ii) case iii)whilc.
C. Wh:i't is tllc~ exit status of a command nnd where is it stored?

7 n. Explain awk ·s build-in vari;1blcs. .• 0


b. Write n progrrul'\ in awk to store the totnls of the bnsic pay, da,.,l1'ra .and gross pay 0~ \~""'•l
and markding p~o·plc. · t e salts
6
C. Briefly describe the bi.Jilt-in functions in awk, with examples'. (0 Mal'\I)
- (08 Markt)

8 a. Write a Perl script to..det¢r~ine whether the given yeVk..is


a lcnp year or not.
(Oi :\iaru)
b. Write :t Perl script to conv~rt"dccimal number to·biriary.
(Oi l\lttl't))
C. Explain variables and nperntors' in Perl.
(Ob Matta)
lft< J,;44

1'~ 1w11rth semester _B. E . Degree Examination, Dcc .2015/.Jan.20 l <>


Umx and Shell Programming

Note: Answer FIVE Jull quest· . , • Max. \,farks. 10{)


at least TWO · wn.'>, .,e1ectmg
quest,ons_from each part.
PAR'f-A
in the Architecture of UNIX opcratin,g system v/th ct· ;:·, ..,
f:J<P Ia r fi tur f U I a neat 1agram. ;- . _ 1os Martu)
~ , ribc the sa ient ea es o N1X operating system. ., '•. (Oi M:11"1' ~)
p~ te OD man command. -~,,,.
i,. v,Jr'rte a no · - :-.~ J (04 Marlu)
C· 1nin the different type~ of files supported Ill lJNlX .- ·, ) .
EtPID nd · d c 1. . · \ 1 ...7 (06 Marks)
a.. .-.T\,,;ch
. , ., = comma is use ior 1stmg file attribute~? Ex l . . 'fi A
• p am s1gm l\,ance{f
of cac h fi1e\d .m t he
b. 0 utpu1- . . · · (03 Mu-ks)
Explain wrth a neat diagram the three modes of Vi - editor:· (06 Maro)
C,
\Vl}at are standard input, sta ndard output and standard erro?? Explain in detail with example.
~ ~~~
Define the term pr~ccss. Explain t~e mechanisrq,-uf l>rocess creation in UN IX. (1)6 Marks)
b. Explain the ~ollo:1-'m~ command with an exam.p}e; ~ '
c. i) Runmng Jobs m background (& and no}.ltrp)
ii) Execute later (at and batch) _,.. ~ (08 Maro)
a. Write a ~te on sort and find _co~~-•J . . (OS Marks)
4 Differentiate betw~ Hard link \l}d_$oft link m UN1X with example.
~: Explain the f~llo~mg co~~~ with example
(%~nu)

i) Head u) tall 111~-f' (06 Marks)


_<r"--':"' PART - B
5 a. What is the differen<;e'between a wild card and regular expression? Explain ' grep' cormnand
using n, ! and f og9§n\vith example. (06 M:aru)
b. What are Ext~ded Regular Expressions? Explain any four ERE set used by grep and egre-p.
· f'_l-.,_: (06 Marks)
c. Explain ~~"adressing and context addressing in sed with example. (08 Marks)
I e;,.
6 a. Whaf'_~"~bell programming? Write a shell program to create a menu which displays,
i) · List of files ii) Current date iii) Process status
_· iv) Current user of the system and v) Quit to UN1X (08 '.\-\:arks)
b-,.,, Explain shell features of 'wbile' and ' for ' with syntax. (06 Marks)
c. Explain the use of test and ( 1to evaluate an expression in sbe\\. (06 Marks)

1 a. What is AWK? Explain any three built - in function in AWK. t06 Marks)
b. Write an AWK sequence to find HR.A, DA and Netpay of an employee, where DA is 50% of
basic, HRA is 12% of basic and the Netpay is the sum ofHRA, DA and Basic 'P'd'i·
(08 ~\ark~)
c. Briefly describe buih in variables in AWK. (06 Muks)

8 a. Explain with example the string handling function supported by perL (08 Muk.s)
b. Explain Lists, Arrays and Associative Arrays with respect to per\. t06 Marls)
c. Write a perl script to convert decimal number to binary number. (06 Mn\.s)

'.1ssrn
V ' LIBRARY, BELAGAVI
Jo, .
I /SN U 111111111
Foall'lh .~,•11u•~h·1· II . It:. r,,1u1·c•,· l 1:~:w1,11Mluu, U c·<·.J, Oft,/,fo ,, .l OI "1
UNIX 1111d Sholl Prouounrnh•fJ
f .,1., /1, f ,1 ,, ~t• ;,,
T1111 1•· .l l11 s . 1
Nofr: Ann••,·r / '/ VHJ )1/l 11111•,'(// 1111,t, 1;1!/1 1·//11g
1

"' "'"·'" '/'Ill () ,,,,,,_y//(ill!t / 1'11111 ,,,,,.,, Jllll'I.

J'tlUl J.
"
~ :1. E.xpl:1i11 rhe s11lil:11I ti..·11111n·s off/NI X 01wm 1i11g 11ynt c 111
h. Wirh 11c,•1r, dingn1111 L'X pl(l /11 11,c 111d1 itcc1 111 r; o f UNI X < 11·:11 ly /)1} 11/~ ,,111 ,1 1,. tJ ,,II .111111"flI 1 ,~If~,
M
1E:!
lwrwco11
.. I . I .
Kt~nw/ 1111d shd /.
· I I
/,,
,,,If .,.
.'4 C. 1 :. xp nm t IC fnllo w 111g <.: llllll ll/ 1111 1:-i WII I l,l Xfl lllJ) CN •rn,,
i) car ii) pwd iii) who iv) lly v) he
~
. :::s 2
tl. Whal i:-i file pl' f'IHissio11 '! Whllt :,re 1/ic ,lit fon.;111 w :1y· 1 u l tic l 1JJ1g fil e pr-r11 1111 ~ 1, 111 ,r 1 t11 l:, ,, o,-,,.,,,,,
1

.k~
_ -:: h. A file 's c11rrc11r 1>cr111is.'i io11 11n, rw r xr spc~ify
. .. 1/1c d 11rK1( I <
11 : Xr>, 1...
,~,.., 1, 111 I • ,,n'1,,
r ~
:O
. V)
change them for the following. Usiug 1,ot/J rc/11 1,v,; 1111<1 :1/J:Jc, lut i; trwl lJrJ,11; ,,r ~~ 1{"-'1
il ,,..,,Pj1
; II
perm issions.
00
iii) r w x r w x r w x iv)
v
('I i) - w- I' r- - ii) r - - r
:-.6 . . ft111 ~,. ,
u
c. Explain the 1Ju·cc modes of Vi editor w1tl1 dmp,rnm. m.-; ,._,~,
~
·c:
~
J J. What is shell process? What nrc tile diffcrc11t phitScs iri fl)(! cr<::a l iori t J/' pro ccrsr{/ ,,n Ma,
r! b. Expfoi11 wht1t wild - c:.ird p111tcms mlllch :
.2
'j [A-Z]7?'??"' iip[0 - 9)"' iii)•[!0 - 9] _ iv) _• ·( IS ]{/11) ff~ Mar
er
u c. What is process status'/ Expl:iin ps command with options. (O~ Ma,
2
r:, Differentiate b~tween foml link and soil link in UNIX witli cxa.mpl c.'i. ·
4 ,L
C W6M11,
'" E.xplain tl1c following tilters with examples:
b.
~
d
~
i) tail ii) tr iii) pr iv) cut. (fl lf ~.,
i c. Explain tlie following environment variables with cxmnplcs:
i) LOGNAME ii) PATH iii) HOME. (IJfi.\hr
PART - H
5 a. With 1.J1c example, ~xplain _t!1c grcp command _any five o~tions. (IIJ Ma,
b. What is sed? Explam the difference between Jmc addrcssmg and w rH cxL a.dcl rcsi; ,n~ m ~.(;(J
( ltJ ,\.far
6 What is shell programming? Write a shell program in order to perform the fo /Jowmc laA!
a.
i) Display current login users ii) print current directory iii) Process status. ,,,8 M
b. Explain the shell features of while and for loop with cxc1mplcs. <O# ~ a,
1
c. Explain trap in shell scripts with suitable example. ("v4 Mu " '

7 a. Explain the following Built in variables of awk with examples.


i) FS ii) NF iii) FILENAME iv) NR. (OH.\ Jar
b. With suitable examples, explain if and while statement in awk. (IJ<, Ma,
c. Explain the following built-in fimctions of nwk with examples :
i) Subscr ii) length iii) index. (0-0 \hr
8 a. Explain the string handling functions of pcrl witl, examples. ,,m ,,,,
b. Explain tlJc followi11g with respect to PERL with example.<;:
i) For ~acl1 looping construct ii) Join. (06 M11
C.
Write a PERL program to print' numhcrs that arc c1cccptcd from the keyboard usi11g while
. ., /('J/Y.., ., (Q<, ,\ li t
,J.' ... t I ' , ,
* * * .jc •., -,; ":.!: ~:•...'·~ \.
.jc

';. ( tH~ M ~~~


j~\~~)
SSCET, LIBRARY, BELAGAVI Jc' U ~1. 1•! ;-,

·°'-•,., jY
''1 'i;. ,
.r; '• .:,•) .
.,,
.

..
,.... ~
\\\I I\ I I I
\ ,l'h Ir• I S10 ""'" h- ,. II .I'·. 11,,11ro•1• It .
UNIX ntul 1'h ,• "Htu\tu,H 4m , .Inn, 'JJJ\'/,
oll I rot1rnmmlnu

Noh· : I \ ,uw,•r I• ,IV.It. /i,1/ , ,, II 111 .11 1 l l, ,,r1 , } 1 I,


1 fl ,!: ,,,,,, 1 tJ,i /; ·II I
t/lW Ntlon ~ ,,ud, fro,~,
1, • !I, 1111, 1,1 l!U1' 1 ·1 Wt J
' ,,,., I\ "'"' l 111, I. ,,

' the !-,1\\IC'lll lcallll'C ~ <>I UNIX


. '~cuss 'rr rI
()~a
• , ,1, If! jl J:. YI\I(' lfl
,he ,Ii ,crcnl I C 1y11ci; 111rn\h,h~~\t 1
pi. \·11'11 'J~~,·x ' It!, l,A,,t';, .,
1,.· f,1,p
» ' , re i11tcrnul 1m1I CJl.\cm 11\ u uni, , 11t1<1i \. ' (<>J>i•
,., nl ,,
1 1 ,r;,l1n~
Jt..j \X'/ ,,
11
-., 'l'·'""" .
tfll-, t;4:,~ 4 ,


V'I I
"[llllP
le&. ' I ,1.vl itH1 ft'11 rA ,;t ro,,,H, ,,:-.1J. rfn
C" • . r: ftp, \,k4 ti'•
el the s1r,111,1c ..mcc of Ilic ii.c vt 11 rte\•\ f t ,
l 1crPr l \' ' t,. 1> l ,~ t.. t 1 -
O· 11 l ;ire file ant l trct.to,-,, pcr111l~~ll111"'' f' , , -~ , 1,11yul ,,-, t.+.--~,
b, wh~ nction with file pcrmh,~iont. t() dt1 ..·r . ,1.plt'' ht,w d1rcct, )f'/ pr;.rn,iV.!f1' r". ~ ·- N/'i ,;
0oJU. · the three model) of' the V\ l'.c.\'l(""' n11nc \01·· 11vt,t it· 11• ·Vf', 1Jft1tu 111
ce~p\a\O rw. t,b-n;c.,
. _ I )'r ,
c. , ·,cu command \me to c<mc;11.c,uitc tw, n '"" -..+..-r.i~
J, wn • u\ inserted hclwccn the C<>n\.tn\ 'r
I~\ f<,c,\ ,u,d
fii(,2. with "iJ ,f{'I!, ~ / ,1 r;.;y'IA tf:,_;;;•.; 'ti",
1ert11'°ued foo2 . I!, CJ t ~ lwc, fi~~ ·n,c oulfl'IJl h~ 10 t,-.; ·:1.rtt-A tr, "
file c:i tffJ. t.f-""''
-..Acntion some. of the _wi\dcard~ that C<JU \d ht u~ni . , ,. .
a. iv, , ing assuc1atctl with them in the v.he\\ . . Wllh \l~ Ult,\ \ 1r,1;t\ ~1.~..:1J, f.~ v,,...4:¢,
roean t'?
m~ta charac I~ .
cuviun 11 ne11t. H,,w <\t) 1/HU turn ,,ff tt\.t n ~r;..1,, ,.,1
~:1.plain the process in lJNJX ,md the rncchani~m <f . ''-' ~~~"
b µ ) procc~~ uetrt.u,11 1"4 ~m,
· E plain the ",o \\ owing
· •
cnv1ronment varhih\tK :
c. .):1. CDPATH ii) TERM ii'1) PS\ ·iv) ,(J_
11
' ,J, '~ l,b,~:t ,

a It is required to co:t the number o~ regular fi\e, lht1t exir.t undtr the tutrt. nt iJtrl;(:t/.,rJ ·~ ,.,.~
· a tJNlX comman _m~ lhat doe11, th,~ ~d very briefly tliseu.~t t'nc P'H'P'YM: r,f 11;.rr.1 1Mf.rcer:.
components that c~1st m the comma~d \inc. ~~ ~ -
b. Explain the fo\l~wmg ~mman~~ with cxamp\c~: i) urn~k \ I ) t()'ud,. ''4 tihr\.t r
C,
Discuss I.he vanous options ava,\ab\c for ~on C<>mmand with e:urrm\e\ "Y
. ttA M.aru,

PAJn -I}
a. E,-p\ain grap comman~ with a\\ options using cxamp\es. 118 MaYbi
b. Discuss line ad<lressmg and context atluressinF, u~ in «.ea C()mmand . \Hu\tf~it •.w r.t,
examples. <lltl-11~,
a. What is shell programming'? fap\a1n with examples, how exprcY-ii<,n,, art evamated m ';hit.~
programming. ,~ ~•b i
b. Discuss the significance of she\\ paramctcri; $4 , ~ , \?and ~O . iw. ~w1
c. Write a shell script that accept'; a string from the terminal and echo a :suiiab\c £re\~ dn
does not have at \east l O characters using i) case iv) expr. 1~ '-hrb>

1 a. What is awk? Discuss any three built - in functions avai\ab\e in aw'( _ l H> ~ B!H
b. Discuss the various built- 1n variables u~d by awk. nt M.2n.'->
i a. Discuss how lists and arrays are used ·m PERL wilh c1.amp\c!>. 1,0 Mar\.,,
b. Mention the different file test operator~ avai\ab\c in PfRL. Discu~ how \ht.\t <lV'nl.Ol~ .n
used for file testing. \\') \1:in\.,1

''.'.iC[ i ,LIBRARY , BELAGAVI


USN , , 1 , 1 , r rm l 0(

Fourth S{'Jll{'Stcr H.E. Ucgrcc Euunination, .Jun e/Jul y 2013


UNIX and Shell Programming

Time: 3 hrs. Max. M:.i rl, I


Note: Answer FIVE full queslimu, selecli11K
' at least TWO questions from each part.

PART-A
I a. With a neat diagram, explain the architecture of unix oper~ting sys_tcm. . 108M :
b. With · the help of a neat diagram, explain the parent-child rclat10nsh1p. Explain unix
system. , (06 ~ ..
C. · Explain briefly absolute pathname and relative pathname with examples. (06 '11

2 a. Give the significanse 9fthe seven fields of the "ls - r' command. (07 M.
b. What is file permission?, Explain how to use "Chmod'.' command to set the permissions
relative manner with an example. (07 Ma
C. Explain the three. difTererit'nfodes in which "V;" editor works. (06 Ma

3 a. Explain .the standard input, . standard output and standard error with respect to U1
operating system. , (07 M1
b. Explain the mechanism of process ~rc~(i~n. (07 Ma
C. What are environment variables?ExpJain any four. (06 Ma
'\. • ,,• I

4 • a. DilTerentiate ·between hard link and soft link with·examples. (06 Ma


.b. Explain "sort" command briefly. Also discuss its important options with examples (
five). - · (06 Ma
C. Explain the foJlowing commands with example:
i) head ii) -.tt. iii) uniq iv) fmd (08Ma

PART-B
5 a Explain 'grep' command with its options. (08 M11
~.. Explain line addressing and context addressing in "sed" with examples. (06 rt-br
d. What are extended regular expression (ERE)? Explain any four ERE set used by "grep'' ,
"egrep". (06 Mar

6 a. Explain the use of "test" and [] to evaluate an expression in shell. (06 Mai
b. Explain the shell features of "while" and "for'' with syntax. (06 ~b i
c. Explain the "expr" command applicable to computation and string functions. (OS "'"

7 a. What is A WK? Explain any three built-in functions in A WK. (07 :\bl
u b. Write short notes on operators and expressions in A WK. (06 ~,.,
0
7. c. Explain built-in variables in AWK. (O'" ;\tar
c
[ 8 3. List the string handling funct ions in PERL. Writ e a program 10 find ,nimlw r l'f ch,11111. ti
E words as well as to print reverse of a given siring. t"-~,\ tJr.
b. Expfo in "chop()" and "split( )" functions with exa mp les. ({)o -' 1''.
c. F.xpfa in ti le handl ing in PERL. ("6 ,\ tJr

KLF Dr MSSC[T, Llf3RAR Y, fJ ELAGAVl


\VI at are WHO "...u .... .> . ~--~•-u• ....... -'l•'-•':'. •• •~'-' 1..U4'-'->, ., i.1. ,., .......ip • ..,..,. '
~- w~at is a process? Explain the proce~~ ·c reation mechanism? Why directory change can~t be
· ade in separate process. . _ (08 Marks)
;xplain the fo_llowing cnvir_~_nment var~ables, with examples:
c. i) HOME 1i) PATH 1n) _lFS 1v) SHELL. (04 Marks)

3.
What are hard links and s~ft link? Explain with examples. (06 Marks)
b. Write a short note on -find conm1and. (06 Marks)
c. Explain the following filters with examples :
i) head iii) tail iii) cut. (08 Marks)

PART-B

a. Explain grep command with a1l options. (10 Marks)


b. What is sed? With example, explain line addressing and context addressing. (10 Marks)

3
· ~Vhat is shell programming? Write a shell script to create a menu which displays :
~) List of files ii) Contents of a file iii) Process status
iv) Current date v) Clear the screen vi) Current users of system. (10 Marks)
b F l·
· -Xp am shell features of' for' . With syntax and examples. (\0 Marks)

~ ~~~ht is cln awk? Explain all the built in variables used by awk. (1~ Marks)
syntax and examples, discuss the control Oow statements used by awk. (10 Marks)
I a

b. wr~te a Perl script to demonstrate the use of chop function. (06 Marks)
rne n p . .
., c. Explain er1sc~1pt to find the square root of co~and lm~ arguments. (06 Marks)
~sctT the strm.g handling functions of Perl with appropnate examples.
(08 Marks)
, LIBRARY, BELAGAVI
*****

l
• ..., ....... --·- --
'.\-1 a.x . M ark.~ ~ ~ .J
,.. : h~ · Noh': A11~,,•t.·r ,11,y 1:-ri ·Efu/1 q11f'stio11."i, s1.~lrcting r .
f lit\'- · .
,1th-a~-, TH '() question~-fr""' ea<..·l1 part. i
<j .·
PART - A v:)"-.,
1
,~ ~ .rlc.,)
1:~hiin the' _~m.'hit~rture ~,f LTNIX _op-crat in~ systen1 ,vith a ne.at di:Jg~,
-~
types o f fl lcs
t ;1. }Hn~tr.H~ , ...-1th :.1 d1sgr.un. th~ typ1c3} UNIX file system and e xp b 111erc:nt
(CUI '.\-l arks)
~- - .J • L•NIX ,_,,
~ur~~)rt\."U 10 .. • · ~....) (~ "t ark1 )
f "f'l:l in int .::rna I :rnd <"-" tema I co1nnmnds w ilh cxamp le. , (:5
,..
:
~

,
I
r

.,.
. •

V
\\.hi"''h l't) 1n n 1and is u~d f0r listing fik attributes? ~. flY describe the significance
O
f ~h
.. j .
tidd l,fr h~ l)Utput. t OS ~1 :.u i.B )
~ .-\ tik · s ~urrcnt permissio~ ar~ nv - r - x r ,~CJspecify the chmod expression requrred to
, , di.l11fe them fl.)r the follo\ving :
i)
_.i)
r ,,,. x r ,v x r \\' x
-~ .. . •- . ... . - r . .,
'l,;
.n r--r ----- ~

t-2ing-t,od1 the relatiYe and abso~~tbods of assigning permissions. (06 \.12rk:s)


\.~- \Yh:.1t are the different rnodes_of.-yi e-ditor? Explain ,vith a diagra1n. (Oo '.\-t-ark.s )

a"'..\(,)
"'~' ..
. ~-"!:...... -:.,_
.
.. .l. E.xpb.in the thre-e st3.9,d;ird nles \\'ith respect to lJNIX operating system. l 06 :'\-lark.5 )
-· hL • E"\-pl~ ~e 1:1ec~apism of_process crea~on using system calls in UNLX. (06 '.\larks )
~- Explam the toll~ g envrronment Y3.nables ,vith examples :
i) SHELL ~
it) LOG~~
ij!) PA.~
i,_·) PS?-:: l 08 '°1 ·u ks)
to< ·s.,.,

t>.-\RT H

-.:-. l . . \ II . - l\l!I M.,l.


n ..'l:p am gn•p N.'nummd w1ti\ ~, ('Jlll'l.'' 1""· 1,v11"\' l t'I
.5 ::i.
. 1 . . t' j J ' " .ll"'\l'< l'l I •l\\ ~ 1I\, , ith
• . •
I " ~)
\llll\l 11CI\.,
b. ,n.-t v 1.·.xolam th,· d,ffb'\'lll \ ' ~ 'l t' I ,\h >.'>", I \l:>t" ll t , I , ,, 11 ._ 11\1.'I " " f 8
1 1•, - .1 I '"')
111'\ -"=" '-"'
;\ , . f
B · • \\'1l\":-
• _., :h . ) ' h , •

c. Exp bin BR[ tfh::i, R..·f-11 1:lr ~i't'\'~:-11'1\ ,· ,.,i,H · 6. ' ~I\ :i,
1
c>xpx-s..,itrns. I (I { ~ •11'1.:,)
d. Writ~ th~ C\)1Hm~1r,tl:- f,,r tlw fr,J1'l\vin. . : ~ ; · ' ···
i) u~· . .~ :- ;.~ t \) .j,, L., t-· ·1111,l" t\ 1' linl"S th, ,n cl tik l\~Unt'·d s:\11\l'k .
•. • _,.I ,, K ' . ' ":.. •
n) l 1sc ~,i 1,, n.·okh~t' nll ,,\·\·1111'\'Jh ,"1.':- l'I th.,· \\'\.H\.I Ll NI.
.. \. '' \\' tlh ''l \Nl l.\.:..'
... vJ
\ri'
,I\, ..
II • '
ti k 11:11 Ht'\I
s3.mpk · R)" (lll Mlll'llt)

6 a What ;, shell µr<>gmmming? Writ< :i m,e1111 - driwll Mell scri ~:21111 the lhllmvi"g :
.9 L~st ofu.,t'rs who an.- logge-d in ~ --,,(
11) l1st of fi k$ in tlk· .:um·nt din:ctorv t'l ..:
iii) Today·~ d:He . '.·,· :--. .
iY) Q~!it t0 UNIX. ,~ ) .. \ON \\hrl..s)
b. E'\pbm with ~n exampk ·:vhik" and ·'to:'' loo1ti'\ s!tdl p~p.rnmnnnf ·. \Oti \\hirl..s)
c. B riefly explam set and sh1t1 -:'Otnmmxi~ m l ~~t\' tmuupuh\tc po~lltt)tu\\ p:lrnntc.'kr~ '"'lh
example. ✓
' (Oh Ml\ t ks)
'

.::·":'\C.t
7 a. What _is A \V~? ~xplain any ~ ~ - in fimctions in A WK . (07 Miatl.1)
b. fa-pl~ a~ocia!1,-e arrn_ys in .-\J\7K/ (06 M•t\.'1)
c. Explam bmlt - m Ya.rfabks i,~~~- (07 Mirks)
,.-.. . . ¼.

8 a. Explain the siring ht1ndii;1g fimrtion5 supportC\i by PERL and nls◊ write a l' E.RL S\'.ript to
convert a given ~ii1n.il number to binary t.--quivnl~nl. (t! l\hrk~)
b. Expllin the fo llowing in PERL wilh e..'Xrunplc :
i) split • 'cJ"
ii) join~ \08 l\t:nks)
?\_0 ... ~h-=-! ·
, ... . .. *****

2l)f~

,!SSCET. LIBRARY, BELAGAVI


0(,CS36
USN \ \ \ \ \ \ \ \ \ \ \
Third Semester B.E. Degree 'Examination, December 201 \
UNIX and She\\ Programming
u
-~u Time: 3 hrs. Max. Marks:\ 00
0
0..
;; Note: Answer any FIVE full questions, selecting atleast TWO
E Questiom, from eacla part.

PART-A.
a. Describe the sa\ient features ofUN\X operatin~system. (03 Marks) ·
b. With the help of a diagram, cx-p\ai.n the UNIX file system. (06 Marks)
c. Explain briefly absolute pathname and relative -pathnames with ex.anrp\es. (06 Marks)

a. Which command is used for listing fi\e attributes? Briefly describe the significance of each
field of the out-put. (03 Marks)
b. What are fl\e. permissions? How do you use Chmod to set the permissions in a re\ative
manner? (08 Mar\.s)
c. Briefly explain S(Substitute) command in ex. mode of a Vi editor. (04 Mar\.s)

a. What are wi\d cards? Explain the she\\s wi\d cards with ex.amp\e. (08 Mar\.s)
b. Exp\ain the command ' PS' . Discuss different options used by 'PS' . (08 Mar\.s)
c. What are environment variables? Ex.p\ain any three. (M Mar\.s)

a. What are hard \inks? Explain 'Ln' command. \06 Mar\.s)


b. Exp\ain briefly the significance of read, write and execute pem1ission for a directory .
(061\\arks)
c. Exp\ain the sort command. Briefly discuss the important sort options. (OS Mnrks)

\>ARi-ll

5 a. What is grcp? Exp\ain any three options and grep with examp\c. {06 Mulls)
b. What arc ex.tended reg,u\ar expressions? Ex.p\ain any four ERE set used by gre-p and egrep.
{OSMar\.s)
c. Briefly cxp\ain the different ways of addressing used in sed, with example. {06 Mnks)

6 a. Explain the significance of special parame~e~ used b~ she\\. . {OS Mulls)


b. How test can be used to test the ft\e perm1ss1on? Wnte a she\\ scnpt to check whether a fi\e
has executable permission OT no\. \06 Msrks)
c. Exp\ain the usage of 'ex.pr' command in she\\ programming. (06 Marks)

"
u 7
Write the syntax of awk 1nstruction. Ex.p~ain w~th examp\e. . (06 Marks)
0 ab. With respect to awk, exp\ain the fo\\owmg w1fu examp\c . i) 'NR and NF ii) index
7. · 00 Maras)
C iii) Split iv) length . v) system. \~ MnKs)
•t
0 c. Explain associative arrays m awk.
C.
~
8 a. Explain the use of chop fun~tion in p~r\ programming. Write a \)Ct\ program whic~;::~:~
user name and disp\ays it w1th a g,reet~ng message. \06 \\\arks)
b. Briefly discuss about lists and arrays m pc;\..) for each \i) s\)\it. (O<, Mat\..s)
c. Explain the fo\\owing, whh res?ect to per '

*****

·.\~?i~n . LIBRARY , BELAGA\JI


13

\;\\
USN I IIIIIIIIII 06CS 36

Third Semester B.E. Degree Examination~ .lanuary 2013


UNIX and Shell Programming

Time: 3 hrs. Max . M arks : l OO


Note: Answer FIVEfu/1 questions, seiecti11g
at least TJ-VO questions from eacl, part.
PART-A
1 a. With a neat diagram, ~xplain the architecture of UNIX. (06 Marks)
b. List and briefly ex~lau~ the features of UNIX. . . (06 Marks)
C. Describe the orgamzat1on of man documentat10n and a typical man page. Hoe do you direct
man to use a specific pager, say, less. (08 Marks)

2 a. What is a file? Describe different types of files in UNIX . (07 Marks)


b. Clearly bring out the command structure, usage and behavior (with respect to absolute and
relative pathnames) of the following commands with suitable examples: i) mkdir ; ii) rmdir.
(06 Marks)
C. Explain the significance of /s-1 output. (07 Marks)

3 a. How do you use chmod command to change file permissions? Explain with illustrative
examples. (06 Marks)
b. Explain the two commands for changing file ownership. (04 Marks)
c. With i1Justrative examples, explain the three modes used by vi editor. (10 Marks)

4 a. What activities are typically performed by the shell in its interpretive cycle? (04 Marks)
b. With suitable examples, discuss how wild-cards can be used for pattern matching in UNIX.
(07 Marks)
C. Explain the importance of three special files for redirection. How UNIX commands can be
grouped based on their use of the standard input and standard output? (09 Marks)

PART-B
5 a. Define a process. Explain the mechanism of process creation. (06 M:irks)
Explain the following environment variables:
b.
i) PATH ; ii) CDPATH ; iii) PS 1 ; iv) TERM. (04 Marks)
c. Explain the significance of the directory permissions. (06 Marks)
d. Explain the pr command with its different options. (04 Marks)

6 a. What are hard links and sofi links? Explain the difference between them with suitable
examples. . (06 Marks)
b. Explain various options of grep with examples. (08 Marks)
C. Explain line addressing and context addressing, using sed, each with an example. (06 Marks)

7 a. What is the purpose of test statement? Explain three ways of using test statement. (07 Marks)
b. Write a note on the "here" document. (04 Marks)
C. With syntax and suitable example, describe how awk works. (04 Marks)
d. State and brief any five (05) built-in functions in awk. (05 Maoo)

8 a. Explain the following functions with suitable examples: i) Split; ii) Join; iii) Splice.
(06 Marks)
b. Write a per1 script that adds the numbers specified as command-line arguments and displays
the result. (06 Msrks)
c. Explain how file handling is managed in perl. Write a perl script to copy contents of a source
file, "sample.in" to a destination file, "sample.out" . (08 l\brk.'i)
Dr MSSCET, LIBRARY, BELAGAVI
* ****
lOC S44

Fourth Semester B.K Oc~nc t~xamination, l>cc .2013/Jan.2014


UNIX and Shell Programming
M ax. Mart.JS · J()()
Time: J hrs.
/ Note: An.v wer FJV/!,'f11II 'lue.v tlmu, i,dec:tlm:
,<<·. .• .,..
111 /('W,I TWO fJlle.•,t/o1U from euc/1 purt.

~ I.
,. (~ ·
r' ; ~ 1• A RT - ftt.. ,1 • _

.
0
··~:1,.bc hricfly the major foaturc ~ of lhc lJNI.X orx,-ra.tin~ :,y-.tcrn. . ;....~ · ('11 Ma.-u)
<1 . o:~~{t~aiilc. With examples. c1.plain the three categoric~ of lik~ !>UPP9r:tcd hy IJ~IX .
b. · 1 .J, . , ' · (Ii, Mar\u)
c. Briefly clc~cr;i~c~
i) System call~;' ii) PATH iii) HOME. r (04 Mar-b)
•. '") < •• I

2 a. Explain the significr.v\p~ of a\\ the field s of /s - I ~put:- Which of the auributes can be
changed only by the sop~~scr? (~ )J (08 Mar1t.s)
b. With a neat diagram, cxpfa'µ1 Jhe thr~ modes of,v~ editor. (06 Marki)
c. Assuming that a file ' s currcfit_.~[missions ar~~ J. t - x r - -, ~-pecify the chmod express ion
(using both relative and absolu~f;netho<ls) requied to change them to:
i) rwx rwx rwx. · ,,<· .
"')
11 r- - r- - - - - . //, .
.1,: )'
iii) - - - r - - r - -
,
/ (._

j" ( ! (06 Maru)
···. ,,r •..
3 a. Devise wild - card patterns tq:~t~h filenames/ ....
i) Comprising of at least tl{jce chara<-1ers whcn~;_ttfe··first char is numeric and the last char is
not alphabetic. f~_, (J
ii) With three charai::te~~xtl-"llsions except the ones ~it~J?g ex.tension.
iii) Containing 2~'5~
an embedded string except at the.beginning or end.
b. Explain the t~J.et,Q1stinct ~hases of ~rocess cre~ion. How illh~}ielt created?
c. What are env,ronment variables? Briefly describe any five ofthtin:-. (06 Mar1's )
; ·. . . . ;9·i,
4 a. Disti.,!}gujsH between hard links and symbolic links with suitable cxa•niplcs. (08 Martu)
b. D,esa,ti6'e' the sort filter and illustrate its usage with -~ -u. - n. -r aoo -c ()ptions. (CM> Maru)
c. i)-'.'-,b;e find to locate all files named a.out and all C source files in your home directory tree
· ·. and remove them interactively.
1i) Display only the names of all users who are logged in and also store ·,~;esult in
uscrs.txt. ~/ · .-.
. ·•. \
iii) In.vokc the vi editor with the last modified file . (Of,~•~~ )

PART-B
5 a. Explain with suitable examples, the scd filter along with its two forms of addressing. Abo
describe in brief the substitution feature provided by secL (031'1arlu)
b. Describe the grep filter along with any five options. (06 Marlu)
c. i) Use sed to delete all blank lines from a file named sample.
ii) Use grep to list only the sub-directories in the current directory.
iii) Replace all occurrences of the word "UNIX" with "UN\JX" in a file named samp\e.
(O<, Marks)

l of2

SCET, LIBRARY , BELAGAVI

You might also like