Você está na página 1de 3

Subject: UNIX & Shell Programming Subject Code: BSIT-43 !!

ignment: TB
1. What is a shell? Explain its importance. Ans.:A shell is a program which is run every time a user logs in and is known as a command interpreter. All the commands entered are run by the shell. he prompt that appears when a user logs in is a shell and waits !or the user to enter a command. When a command is entered" the shell scans the command line !or met characters" i.e." characters that have a special meaning to the shell. A!ter processing the met characters" the shells send the command line to the kernel !or execution. he shell waits !or the kernel to complete execution and then display the prompt !or the next command. his interpretive cycle continues !or the next command. #. Write a $%&' command to count how many users have logged on to the $%&' system. Ans :Who (ommand to count how many users have logged on to the $%&' system. )ists the user*s name" terminal line and login date and time + Who ,ibns 1ysr 3cepay ttypttyp1 ttyp# .ec #/ 10:-/ .ec #/ 10:21 .ec #/ 10:24

)ists only the names and number o! users logged in + Who 56 ,ibns 8 $sers90 0. :ow is a 7ob run periodically in $%&' system? Explain with an example. !ysr 7cepay

Ans :A task can be automatically run in the background at regular intervals by a $%&' utility called cron. he cron daemon takes care o! running these background 7obs" which are called 7ob run periodically. Example he !ollowing line in the crontab !ile removes all core !iles;users;users1 everyday at <:0- =>. 01/ ? ? ? rm;user;user1;core

4. What is a process? Explain the mechanism o! process (reation in $%&' system.

Ans :A process in $%&' is an executing program" which is identi!ied by a uni6ue =&. or a process identi!ier. A !ile is a collection o! data created by a user using !eatures" such as text editor and compilers"

2.

What is a !ilter? Explain any !ive !ilters in $%&' system.

Ans.:A !ilter is a program that takes its input !rom the standard input !ile" processes @or !iltersA it" and sends its output to the standard output !ile. $%&' has a rich set o! !ilters that can be used to work on data in an e!!ective way. ,ome examples o! !ilters are cat" grep" wc" tr" and cut.

B. Write a shell script to check whether given year is a leap year or not. Ans :he !ollowing command can be used to !ind whether the year 1/-- is a leap year or not : + (al # 1/-- as the output is showing #C days in 1ebruary" 1/-- was not a leap year. <. Explain the di!!erent types o! variables in shell. Ans :here are three types o! variables commonly used in shell. 1A Environment Dariables: ,ometimes called special shell variables" keyword variables" prede!ined shell variables" or standard shell variables" they are used to tailor the operating environment to suit your needs. Examples =A :" EE>" :F>E" and >A&). #A $ser-de!ined Dariables: hese are variables that you create yoursel!. 0A =ositional =arameters: hese are used by the shell to store the values o! command-line arguments.

C. What is the signi!icance o! write and talk command in $%&'. Ans. he write command copies the text !rom one user terminal to the terminal o! another user who is also logged on the $%&' operating system. he recipient can reply the sender by writing on his terminal and communication starts between the two users. he (ommunication continues until an end-o!-!ile is read !rom the terminal or an interrupt is sent. he talk command is a visual communication program that copies lines !rom a user terminal to the terminal o! another user. he talk command splits the user terminal into two sections. he upper section is used by the sender to write messages and the lower section displays the received messages.

Você também pode gostar