You are on page 1of 3

SHELLPROGRAMS

USINGCOMMANDS
1.
2.
3.
4.

Writeaprogramtogetthenameandregnoandwhocommandtodisplaytheuserslogintime.
Findthelinescontaininganumberinafile.
Writeaprogramtodisplaythelistofuserscurrentlyworkingandtotal.
Writeashellscriptprogramtoconvertallthecontentinafileintouppercase.

USINGCOMMANDLINEARGUMENTS
1. WriteashellScriptthatdemos,commandlinearguments.
2. WriteashellScriptwhichreceivestwofilesnamesasaarguments.Itshouldcheckwhetherthe
twofilescontentsaresameornot.Iftheyaresamethenremovesecondfile.
3. Writeashellscripttocheckwhetheragivenuserisloggedinornot.
4. WriteaProgramtoopentxtfilebyusingcatcommand.
5. Writeashellscripttofindtheaverageofthenumbersenteredincommandline.
USINGPRINTINGSTATEMENT
1. Writeashellscripttoaskyourname,programnameandenrollmentnumberandprintitonthe
screen.
USINGSTRINGSTATEMENT
1. Writeashellprogramtoconcatenatethecontentsof2files.
2. Writeashellscriptprogramtoconcatenatetwofilecontentandfindthelengthoftheresultant
string.
3. Writeashellscriptprogramtoconcatenatetwostringsandfindthelength.
4. Writeashellprogramtocountthecharacters,linesandwordsinafile.
5. Writeashellscripttoperformthefollowingstringoperationtoextractasubstringfromagiven
stringandtofindthelengthofthegivenstringusingswitchcase.
6. Writeaninteractiveshellscriptthatasksforawordandfilenameandthentellshowmanytimes
thatwordoccurredinthefile.
7. Writeashellscriptprogramtofindthepositionofsubstringinagivenstring.
8. Writeashellscriptprogramtofindthenumberofvowelsinagivenstring.
9. Writeashellscriptprogramtocheckwhetherthegivenstringispalindromeornot.
10.
Write a shell program to count number of words, characters, white spaces and special
symbolsinagiventext.
SIMPLEPROGRAMMESUSINGCOMMANDLINEARGUMENTS
1. Writeashellprogramtoadd,subtractandmultiplythe2givennumberspassedascommandline

arguments

SIMPLEPROGRAMMES
1.
2.
3.
4.
5.
6.

Writeashellscripttofindthesum,theaverageandtheproductofthefourintegersentered.
Writeashellscriptprogramtofindsimpleandcompoundinterest.
Writeashellscriptprogramtoswaptwonumbers.
Writeashellscriptprogramtofindthepowerofx.
Writeashellprogramtocheckwhetheragivenyearisleapyearornot.
Writeaprogramtofindthequadraticequation

USINGIFSTATEMENT
1.
2.
3.
4.

Writeashellscriptprogramtofindwhetherthegivennumberisoddoreven.
Writeashellscriptprogramtocheckwhetherthegivennumberispositiveornegative.
Writeashellscriptprogramtofindthesmallestandgreatestvalueamongthegivennumbers.
Write a shell script program to compute the gross salary of a employee according to the
followingrules.
a.Ifbasicsalaryis<1500thenhra=10%ofthebasicandda=90%ofthebasic.
b.Ifbasicsalaryis>=1500thenhra=Rs500andda=98%ofthebasic.
5.Writeashellscriptprogramtogetfivesubjectmarksandfindthegrade.
6.Writeashellscriptprogramtofindthequadraticequation
USINGFORLOOP
1. Writeashellscriptprogramtodisplaythedigitswhichareinoddpositioninagivennumber.
USINGWHILEDOSTATEMENT
1.
2.
3.
4.
5.
6.

Writeashellscriptprogramtofindthepowerofxusingwhilestatement.
Writeashellscriptprogramtofindthesumofdigits.
WriteashellscriptprogramtogenerateFibonacciseries.
Writeashellprogramtoreversethedigitsoffivedigitinteger.
Writeashellprogramtofindfactorialofgivennumber.
Writeashellprogramtodisplaythealternatedigitsinagiven7digitnumberstartingfromthe
firstdigit.

USINGWHILEANDIFSTATEMENTS
1. Writeashellscriptprogramtocheckwhetherthegivennumberisprimeornot.
2. Writeashellprogramtofindthesumoftheseriessum=1+1/2+...+1/n.
3. Writeashellprogramtofindthegcdforthe2givennumbers/

4. Writeashellscriptprogramtocheckwhetherthegivennumberispalindromeornot.
5. WriteashellscriptprogramtogenerateArmstrongseriesuptogivennumber.
6. WriteaShellscripttofindoccurrenceofparticulardigitininputtednumber
USINGARRAYVALUES
1.
2.
3.
4.
5.

Writeashellscriptprogramtofindthesumofsquares.
Writeashellscriptprogramtofindthestandarddeviation.
Writeashellscriptprogramtofindthesumandaverageusingarray.
Writeashellscriptprogramtosortthevaluesinascendingorder.
Writeashellscriptprogramtosortthevaluesindescendingorder

USINGSWITCHCASESTATEMENT
1. Writeashellscriptprogramtodoarithmeticoperationusingswitchcase.
2. Writeaprograminswitchcaseusingcommand.
3. Writeashellscriptprogramtofinddate/time,listoffilesincurrentdirectory,calenderandvi
editorusingswitchcase.
4. Writeaprogramtoexecutewordcountbyusingcommandlineargument.
5. Writeaprogramtocalculaterandomnumbers.
6. Writeaprogramtoprintthearrayvalues.
7. Writeaprogramtoprintthegivenvaluesinfloatingpoint.
8. Writeaprogramtoprinttheincrementanddecrementvalueusingforloop.
9. Writeaprogramtodisplaythevaluesdecreasingby25.
10.
Writeaprogramtodisplaytheouterloopandinnerloop.
11.
Writeaprogramtoprintthestatenameusingteststatement.
12.
Writeaprogramtoprintthestatementgivenintheecho.
13.
Writeaprogramtoprintthearrayvaluesadditionofaandb.
14.
Writeaprograminswitchcasetoprintthestatement.
15.
Writeashellscripttofindthelargestamongthe3givennumbers.
16.
Write a shell program to search for a given number from the list of numbers
providedusingbinarysearchmethod.
17.
Writeashellscripttofindthesmallestofthreenumbers.
18.
WriteashellscripttosortthegivennumbersindescendingorderusingBubblesort.
19.
WriteaShellScripttoreverseainputtedstringandshowit

You might also like