Question: part 1/3 ChAPTER 8, LAB 1: Writing AND ExECUTING A SHELL SCRIPT (20 MinUTES) LEARNING OBJECtives AND OUTCOMES In this lab sou will leaen na
ChAPTER 8, LAB 1: Writing AND ExECUTING A SHELL SCRIPT (20 MinUTES) LEARNING OBJECtives AND OUTCOMES In this lab sou will leaen na wrine and csevese a shell scrigr ithat ind dudes compents, You will use chmod to make the file thar holde the senge esecutable and include a line that starts with at in the seript ne male sare bash execafes it. This lab ahe provides an introduction to positional purameterk. READING Read "Writies and Euccutine a Simple Sheil Script" een pagen 234-289 of Sobell. Procedure 1. Whe vim me cat iser page lis et ahis lah mannal far inatrucrions) to create a file named ahoer with the fellseses line in in 2. Hue cat wo cerify the concrnets of ahart and then my te execuse ir. Whe la t to display the prrminines for abeet. Read the tip en Sobell, juge 286. 3. Uee ehmod ifobell, puges 47 and 2351 to make the file exenutable, display the perminines fir ahorl, and try enecueing dhe file agait. 4. Add a line thar wtarts with at isebeil, fuge 287 ) bo the heginning of short so make sare it is cxeconed by bash. dark. 6. Wiahin a shell script, the shell ecgumb $1 ia varialle called a poritionsl furdweters Sobell, page 46dis to the first argumerie oe the cumanand line the script was called with. Wrine and esenete a sigin named firs that displays. (urnde to standand outputi the firse argument ce the commuind line it was called wilh. Incluse the At lee and a onennent. Reminter no make the file exncutable. 7. Weite a shell wige that oopies the file sumed by ins fint aepument to a file with the aame tame with ale filmame erticnsinit of bak. Thus, if you call the scripe wieh the arguntent first fasd a file named first exion in the wuek. ing diresteryl, after the sinige nos yoe would heve rwe files firs and firstbak. Demonstate the athe koripe aurks preperly. 3. Read the caution tatlind - Miways equnte puitiontl parameters" on juge 462 of Sobell. Whe touah so crrate a file mhene name has a bhes in it. What hap- pens when you give that filesame at an arpinent to quebulk from the previcren step? Modify the cpechak wrije fruen the pervioes atep by queting the positional parameters in the op lies. Now what hagpens when you use the keripe so make a copy of a fille with a war im in name? DeLiverAbles This lab gies you practice writing amd esnwing shall wripes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
